Skip to content

Commit

Permalink
[maria-check-constraints] Add fix-constraints chart
Browse files Browse the repository at this point in the history
  • Loading branch information
s10 committed Jan 17, 2025
1 parent f178917 commit 24a7dfc
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/common/inventory-updater @BerndKue
/common/linkerd-support @majewsky @SuperSandro2000 @VoigtS @Nuckal777
/common/manila-provisioner @jknipper # old
/common/maria-check-constraints @s10 @businessbean @galkindmitrii
/common/mariadb @galkindmitrii @stefanhipfel @Carthaca @IvoGoman @fwiesel @businessbean @occamshatchet
/common/mariadb-galera @businessbean @bashar-alkhateeb
/common/memcached @auhlig @businessbean @bashar-alkhateeb
Expand Down
23 changes: 23 additions & 0 deletions common/maria-check-constraints/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions common/maria-check-constraints/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: owner-info
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 1.0.0
digest: sha256:45a74346d8c73d1b61264fa06d5cb48d3dc38abcfbaa2900b0b918fb532b52ba
generated: "2025-01-17T16:29:18.703347+02:00"
16 changes: 16 additions & 0 deletions common/maria-check-constraints/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: v2
name: maria-check-constraints
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "202501161755"
maintainers:
- name: Birk Bohne
url: https://github.com/businessbean
- name: Vlad Gusev
url: https://github.com/s10
dependencies:
- name: owner-info
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 1.0.0
5 changes: 5 additions & 0 deletions common/maria-check-constraints/ci/test-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
global:
region: regionOne
tld: test.corp
registryAlternateRegion: other.docker.registry
51 changes: 51 additions & 0 deletions common/maria-check-constraints/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "maria-check-constraints.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "maria-check-constraints.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "maria-check-constraints.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "maria-check-constraints.labels" -}}
helm.sh/chart: {{ include "maria-check-constraints.chart" . }}
{{ include "maria-check-constraints.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "maria-check-constraints.selectorLabels" -}}
app.kubernetes.io/name: {{ include "maria-check-constraints.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
39 changes: 39 additions & 0 deletions common/maria-check-constraints/templates/job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- range $database, $config := $.Values.databases }}
{{- $secret := $config.secret | default dict}}
{{- $secretName := coalesce $secret.name $.Values.secret.name }}
{{- $secretKey := coalesce $secret.key $.Values.secret.key }}
{{- if ne $config.enabled false }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: maria-check-constraints-{{ $config.name }}
labels:
{{- include "maria-check-constraints.labels" $ | nindent 4 }}
spec:
backoffLimit: 1
template:
spec:
restartPolicy: Never
containers:
- name: maria-check-constraints
image: {{ required ".Values.global.registryAlternateRegion is missing" $.Values.global.registryAlternateRegion }}/{{ $.Values.image.name }}:{{ $.Values.image.tag }}
command:
- /usr/bin/maria-check-constraints
- --dry-run={{ $.Values.dryRun }}
env:
- name: DB_HOST
value: {{ $config.host }}.{{ $config.namespace }}.svc.kubernetes.{{ $.Values.global.region }}.{{ $.Values.global.tld }}
- name: DB_PORT
value: {{ $config.port | quote }}
- name: DB_NAME
value: {{ $config.schema | quote }}
- name: DB_USERNAME
value: {{ $config.username | quote }}
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ tpl $secretName . }}
key: {{ $secretKey }}
{{- end }}
{{- end }}
131 changes: 131 additions & 0 deletions common/maria-check-constraints/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
owner-info:
support-group: network-api
service: maria-check-constraints
maintainers:
- Vladislav Gusev
- Birk Bohne
helm-chart-url: "https://github.com/sapcc/helm-charts/tree/master/common/maria-check-constraints"

image:
name: 'maria-check-constraints'
tag: '202501161755'

dryRun: true

secret:
name: "mariadb-sync-{{ $.name }}-secrets"
key: "sourceDBPW"

databases:
barbican:
name: barbican
namespace: 'monsoon3'
host: 'barbican-mariadb'
port: '3306'
username: 'root'
schema: 'barbican'
cinder:
name: cinder
namespace: 'monsoon3'
host: 'cinder-mariadb'
port: '3306'
username: 'root'
schema: 'cinder'
desigate:
name: designate
namespace: 'monsoon3'
host: 'designate-mariadb'
port: '3306'
username: 'root'
schema: 'designate'
glance:
name: glance
namespace: 'monsoon3'
host: 'glance-mariadb'
port: '3306'
username: 'root'
schema: 'glance'
ironic:
name: ironic
namespace: 'monsoon3'
host: 'ironic-mariadb'
port: '3306'
username: 'root'
schema: 'ironic'
keystone:
name: keystone
namespace: 'monsoon3'
host: 'keystone-mariadb'
port: '3306'
username: 'root'
schema: 'keystone'
manila:
name: manila
namespace: 'monsoon3'
host: 'manila-mariadb'
port: '3306'
username: 'root'
schema: 'manila'
neutron:
name: neutron
namespace: 'monsoon3'
host: 'neutron-mariadb'
port: '3306'
username: 'root'
schema: 'neutron'
nova:
name: nova
namespace: 'monsoon3'
host: 'nova-mariadb'
port: '3306'
username: 'root'
schema: 'nova'
nova-cell0:
name: nova-cell0
namespace: 'monsoon3'
host: 'nova-mariadb'
port: '3306'
username: 'root'
secret:
name: 'mariadb-sync-nova-secrets'
schema: 'nova_cell0'
nova-cell-vc-b-1:
enabled: false
name: nova-cell-vc-b-1
namespace: 'monsoon3'
host: 'nova-cell-vc-b-1-mariadb'
port: '3306'
username: 'root'
schema: 'nova_cell_vc_b_1'
nova-api:
name: nova-api
namespace: 'monsoon3'
host: 'nova-api-mariadb'
port: '3306'
username: 'root'
schema: 'nova_api'
octavia:
name: octavia
namespace: 'monsoon3'
host: 'octavia-mariadb'
port: '3306'
username: 'root'
schema: 'octavia'
placement:
name: placement
namespace: 'monsoon3'
host: 'nova-api-mariadb'
port: '3306'
username: 'root'
schema: 'placement'
# placement:
# name: placement
# namespace: 'monsoon3'
# host: 'nova-api-mariadb'
# port: '3306'
# username: 'root'
# secret:
# name: 'mariadb-placement'
# key: 'root-password'
# schema: 'placement'

0 comments on commit 24a7dfc

Please sign in to comment.