Skip to content

Commit 2aa2072

Browse files
committed
[maria-check-constraints] Add fix-constraints chart
1 parent 0d372b6 commit 2aa2072

File tree

8 files changed

+267
-0
lines changed

8 files changed

+267
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
/common/prometheus-server @viennaa @richardtief @Kuckkuck @IvoGoman @timojohlo
2323
/common/prometheus-server-pre7 @viennaa @richardtief @Kuckkuck @IvoGoman @timojohlo
2424
/common/pxc-db @s10 @businessbean @galkindmitrii
25+
/common/maria-check-constraints @s10 @businessbean @galkindmitrii
2526
/common/rabbitmq @galkindmitrii @fwiesel @Carthaca @bashar-alkhateeb @dusandordevicsap @businessbean
2627
/common/rabbitmq-cluster @galkindmitrii @notandy @defo89 @businessbean
2728
/common/redis* @majewsky @SuperSandro2000 @VoigtS @Nuckal777
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: owner-info
3+
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
4+
version: 1.0.0
5+
digest: sha256:45a74346d8c73d1b61264fa06d5cb48d3dc38abcfbaa2900b0b918fb532b52ba
6+
generated: "2025-01-17T16:29:18.703347+02:00"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
apiVersion: v2
3+
name: maria-check-constraints
4+
description: A Helm chart for Kubernetes
5+
type: application
6+
version: 0.1.0
7+
appVersion: "202501161755"
8+
9+
dependencies:
10+
- name: owner-info
11+
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
12+
version: 1.0.0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
global:
3+
region: regionOne
4+
tld: test.corp
5+
registryAlternateRegion: other.docker.registry
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "maria-check-constraints.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "maria-check-constraints.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "maria-check-constraints.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "maria-check-constraints.labels" -}}
37+
helm.sh/chart: {{ include "maria-check-constraints.chart" . }}
38+
{{ include "maria-check-constraints.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "maria-check-constraints.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "maria-check-constraints.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{- range $database, $config := $.Values.databases }}
2+
{{- $secret := $config.secret | default dict}}
3+
{{- $secretName := coalesce $secret.name $.Values.secret.name }}
4+
{{- $secretKey := coalesce $secret.key $.Values.secret.key }}
5+
{{- if ne $config.enabled false }}
6+
---
7+
apiVersion: batch/v1
8+
kind: Job
9+
metadata:
10+
name: maria-check-constraints-{{ $config.name }}
11+
labels:
12+
{{- include "maria-check-constraints.labels" $ | nindent 4 }}
13+
spec:
14+
backoffLimit: 1
15+
template:
16+
spec:
17+
restartPolicy: Never
18+
containers:
19+
- name: maria-check-constraints
20+
image: {{ required ".Values.global.registryAlternateRegion is missing" $.Values.global.registryAlternateRegion }}/{{ $.Values.image.name }}:{{ $.Values.image.tag }}
21+
command:
22+
- /usr/bin/maria-check-constraints
23+
- --dry-run={{ $.Values.dryRun }}
24+
env:
25+
- name: DB_HOST
26+
value: {{ $config.host }}.{{ $config.namespace }}.svc.kubernetes.{{ $.Values.global.region }}.{{ $.Values.global.tld }}
27+
- name: DB_PORT
28+
value: {{ $config.port | quote }}
29+
- name: DB_NAME
30+
value: {{ $config.schema | quote }}
31+
- name: DB_USERNAME
32+
value: {{ $config.username | quote }}
33+
- name: DB_PASSWORD
34+
valueFrom:
35+
secretKeyRef:
36+
name: {{ tpl $secretName . }}
37+
key: {{ $secretKey }}
38+
{{- end }}
39+
{{- end }}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
owner-info:
3+
support-group: network-api
4+
service: maria-check-constraints
5+
maintainers:
6+
- "Vladislav Gusev"
7+
helm-chart-url: "https://github.com/sapcc/helm-charts/tree/master/common/maria-check-constraints"
8+
9+
image:
10+
name: 'maria-check-constraints'
11+
tag: '202501161755'
12+
13+
dryRun: true
14+
15+
secret:
16+
name: "mariadb-sync-{{ $.name }}-secrets"
17+
key: "sourceDBPW"
18+
19+
databases:
20+
barbican:
21+
name: barbican
22+
namespace: 'monsoon3'
23+
host: 'barbican-mariadb'
24+
port: '3306'
25+
username: 'root'
26+
schema: 'barbican'
27+
cinder:
28+
name: cinder
29+
namespace: 'monsoon3'
30+
host: 'cinder-mariadb'
31+
port: '3306'
32+
username: 'root'
33+
schema: 'cinder'
34+
desigate:
35+
name: designate
36+
namespace: 'monsoon3'
37+
host: 'designate-mariadb'
38+
port: '3306'
39+
username: 'root'
40+
schema: 'designate'
41+
glance:
42+
name: glance
43+
namespace: 'monsoon3'
44+
host: 'glance-mariadb'
45+
port: '3306'
46+
username: 'root'
47+
schema: 'glance'
48+
ironic:
49+
name: ironic
50+
namespace: 'monsoon3'
51+
host: 'ironic-mariadb'
52+
port: '3306'
53+
username: 'root'
54+
schema: 'ironic'
55+
keystone:
56+
name: keystone
57+
namespace: 'monsoon3'
58+
host: 'keystone-mariadb'
59+
port: '3306'
60+
username: 'root'
61+
schema: 'keystone'
62+
manila:
63+
name: manila
64+
namespace: 'monsoon3'
65+
host: 'manila-mariadb'
66+
port: '3306'
67+
username: 'root'
68+
schema: 'manila'
69+
neutron:
70+
name: neutron
71+
namespace: 'monsoon3'
72+
host: 'neutron-mariadb'
73+
port: '3306'
74+
username: 'root'
75+
schema: 'neutron'
76+
nova:
77+
name: nova
78+
namespace: 'monsoon3'
79+
host: 'nova-mariadb'
80+
port: '3306'
81+
username: 'root'
82+
schema: 'nova'
83+
nova-cell0:
84+
name: nova-cell0
85+
namespace: 'monsoon3'
86+
host: 'nova-mariadb'
87+
port: '3306'
88+
username: 'root'
89+
secret:
90+
name: 'mariadb-sync-nova-secrets'
91+
schema: 'nova_cell0'
92+
nova-cell-vc-b-1:
93+
enabled: false
94+
name: nova-cell-vc-b-1
95+
namespace: 'monsoon3'
96+
host: 'nova-cell-vc-b-1-mariadb'
97+
port: '3306'
98+
username: 'root'
99+
schema: 'nova_cell_vc_b_1'
100+
nova-api:
101+
name: nova-api
102+
namespace: 'monsoon3'
103+
host: 'nova-api-mariadb'
104+
port: '3306'
105+
username: 'root'
106+
schema: 'nova_api'
107+
octavia:
108+
name: octavia
109+
namespace: 'monsoon3'
110+
host: 'octavia-mariadb'
111+
port: '3306'
112+
username: 'root'
113+
schema: 'octavia'
114+
placement:
115+
name: placement
116+
namespace: 'monsoon3'
117+
host: 'nova-api-mariadb'
118+
port: '3306'
119+
username: 'root'
120+
schema: 'placement'
121+
# placement:
122+
# name: placement
123+
# namespace: 'monsoon3'
124+
# host: 'nova-api-mariadb'
125+
# port: '3306'
126+
# username: 'root'
127+
# secret:
128+
# name: 'mariadb-placement'
129+
# key: 'root-password'
130+
# schema: 'placement'

0 commit comments

Comments
 (0)