Skip to content

Commit

Permalink
Merge pull request #7748 from sapcc/masakari_mariadb
Browse files Browse the repository at this point in the history
Bring back MariaDB and remove proxySQL
  • Loading branch information
soofff authored Feb 10, 2025
2 parents 3dd7f31 + a52afec commit b2f46f1
Show file tree
Hide file tree
Showing 19 changed files with 101 additions and 238 deletions.
7 changes: 5 additions & 2 deletions openstack/masakari/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
dependencies:
- name: mariadb
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 0.15.3
- name: rabbitmq
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 0.7.2
Expand All @@ -14,5 +17,5 @@ dependencies:
- name: linkerd-support
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 1.0.0
digest: sha256:8b0fc0c4a2031222b1fa58eb4ede43691cebb346385fd4088feaad6832b34516
generated: "2024-11-25T14:04:10.703690807+01:00"
digest: sha256:addcf2e141f96cc5c3205b67ca798909c8b1621b019b7f6d86607a4885139a19
generated: "2025-02-07T16:16:40.623851441+01:00"
3 changes: 3 additions & 0 deletions openstack/masakari/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ name: masakari
version: 0.1.0
appVersion: "bobcat"
dependencies:
- name: mariadb
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 0.15.3
- name: rabbitmq
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
version: 0.7.2
Expand Down
10 changes: 0 additions & 10 deletions openstack/masakari/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
{{- define "job_name" }}
{{- $name := index . 1 }}
{{- with index . 0 }}
{{- $all := list (include "utils.proxysql.job_pod_settings" . ) (include "utils.proxysql.volume_mount" . ) (include "utils.proxysql.container" . ) (include "utils.proxysql.volumes" .) (tuple . (dict) | include "utils.snippets.kubernetes_entrypoint_init_container") (include "utils.trust_bundle.volume_mount" . ) (include "utils.trust_bundle.volumes" .) | join "\n" }}
{{- $hash := empty .Values.proxysql.mode | ternary "" $all | sha256sum }}
{{- .Release.Name }}-{{ $name }}-{{ substr 0 4 $hash }}-{{ .Values.imageVersion | required "Please set .imageVersion or similar"}}
{{- end }}
{{- end }}


{{- define "db_name" -}}
"{{ .Values.mariadb.name }}-mariadb"
{{- end }}
Expand Down
17 changes: 2 additions & 15 deletions openstack/masakari/templates/api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,19 @@ spec:
kubectl.kubernetes.io/default-container: {{ .Chart.Name }}-api
configmap-etc-hash: {{ include (print $.Template.BasePath "/etc-configmap.yaml") . | sha256sum }}
secrets-hash: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
{{- if .Values.proxysql.mode }}
prometheus.io/scrape: "true"
prometheus.io/targets: {{ required ".Values.alerts.prometheus missing" .Values.alerts.prometheus | quote }}
{{- end }}
{{- include "utils.linkerd.pod_and_service_annotation" . | indent 8 }}
spec:
{{ tuple . "masakari" "api" | include "kubernetes_pod_anti_affinity" | indent 6 }}
{{- include "utils.proxysql.pod_settings" . | indent 6 }}
initContainers:
- name: masakari-init-database
image: {{ required ".Values.global.registry is missing" .Values.global.registry}}/loci-masakari:{{.Values.imageVersion | required "Please set .imageVersion or similar" }}
command:
- masakari-manage
- db
- masakari-manage
- db
- sync
volumeMounts:
- name: masakari-database
mountPath: /database
- mountPath: /etc/masakari
name: masakari-etc
- mountPath: /etc/masakari/masakari.conf.d
Expand Down Expand Up @@ -83,24 +78,16 @@ spec:
- name: masakari-api
containerPort: {{.Values.masakariApiPortInternal}}
volumeMounts:
- name: masakari-database
mountPath: /database
- mountPath: /etc/masakari
name: masakari-etc
- mountPath: /etc/masakari/masakari.conf.d
name: masakari-etc-confd
{{- include "utils.proxysql.volume_mount" . | indent 8 }}
{{- include "utils.trust_bundle.volume_mount" . | indent 8 }}
{{- include "utils.proxysql.container" . | indent 6 }}
volumes:
- name: masakari-database
persistentVolumeClaim:
claimName: masakari-database
- name: masakari-etc
configMap:
name: masakari-etc
- name: masakari-etc-confd
secret:
secretName: masakari-etc
{{- include "utils.proxysql.volumes" . | indent 6 }}
{{- include "utils.trust_bundle.volumes" . | indent 6 }}
1 change: 1 addition & 0 deletions openstack/masakari/templates/api-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
system: openstack
type: api
component: {{ .Chart.Name }}
app: {{ template "fullname" . }}
annotations:
{{- include "utils.linkerd.pod_and_service_annotation" . | indent 4 }}
spec:
Expand Down
44 changes: 0 additions & 44 deletions openstack/masakari/templates/configmap-backup.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions openstack/masakari/templates/configmap-upload.yaml

This file was deleted.

84 changes: 0 additions & 84 deletions openstack/masakari/templates/cronjob-backup.yml

This file was deleted.

12 changes: 0 additions & 12 deletions openstack/masakari/templates/database-pvc.yaml

This file was deleted.

65 changes: 65 additions & 0 deletions openstack/masakari/templates/db-migrate-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: batch/v1
kind: Job
metadata:
# since this name changes with every image change, removal and creation of
# this Job happens on nearly every deployment. Check the helm-chart changes
# to see if this needs more review.
name: {{ .Release.Name }}-db-migrate-{{ .Values.imageVersion | required "Please set .imageVersion or similar" }}
labels:
system: openstack
type: configuration
component: {{ .Chart.Name }}
spec:
template:
metadata:
labels:
alert-tier: os
alert-service: {{ .Chart.Name }}
{{ tuple . .Release.Name "db-migrate" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
{{- include "utils.linkerd.pod_and_service_annotation" . | indent 8 }}
spec:
restartPolicy: OnFailure
initContainers:
{{- tuple . (dict "service" (include "db_name" .)) | include "utils.snippets.kubernetes_entrypoint_init_container" | indent 6 }}
containers:
- name: db-migrate
image: {{ required ".Values.global.registry is missing" .Values.global.registry}}/loci-masakari:{{.Values.imageVersion | required "Please set .imageVersion or similar" }}
imagePullPolicy: IfNotPresent
{{ toYaml .Values.securityContext | indent 8 }}
command:
- dumb-init
- bash
- -c
- |
set -euo pipefail
if which masakari-manage; then
masakari-manage db sync
else
sleep 5
fi
{{- include "utils.script.job_finished_hook" . | nindent 10 }}
env:
{{- if .Values.sentry.enabled }}
- name: SENTRY_DSN
valueFrom:
secretKeyRef:
name: sentry
key: {{ .Chart.Name }}.DSN.python
{{- end }}
- name: PYTHONWARNINGS
value: {{ .Values.python_warnings | quote }}
volumeMounts:
- mountPath: /etc/masakari
name: masakari-etc
- mountPath: /etc/masakari/masakari.conf.d
name: masakari-etc-confd
{{- include "utils.trust_bundle.volume_mount" . | indent 8 }}
volumes:
- name: masakari-etc
configMap:
name: masakari-etc
- name: masakari-etc-confd
secret:
secretName: masakari-etc
{{- include "utils.trust_bundle.volumes" . | indent 6 }}
9 changes: 0 additions & 9 deletions openstack/masakari/templates/engine-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,11 @@ spec:
kubectl.kubernetes.io/default-container: {{ .Chart.Name }}-engine
configmap-etc-hash: {{ include (print $.Template.BasePath "/etc-configmap.yaml") . | sha256sum }}
secrets-hash: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
{{- if .Values.proxysql.mode }}
prometheus.io/scrape: "true"
prometheus.io/targets: {{ required ".Values.alerts.prometheus missing" .Values.alerts.prometheus | quote }}
{{- end }}
{{- include "utils.linkerd.pod_and_service_annotation" . | indent 8 }}
spec:
{{ tuple . "masakari" "engine" | include "kubernetes_pod_anti_affinity" | indent 6 }}
{{- include "utils.proxysql.pod_settings" . | indent 6 }}
containers:
- name: {{ .Chart.Name }}-engine
image: {{ required ".Values.global.registry is missing" .Values.global.registry}}/loci-masakari:{{.Values.imageVersion | required "Please set .imageVersion or similar" }}
Expand Down Expand Up @@ -82,22 +79,16 @@ spec:
resources:
{{ toYaml .Values.pod.resources.masakari | indent 10 }}
volumeMounts:
- name: masakari-database
mountPath: /database
- mountPath: /etc/masakari
name: masakari-etc
- mountPath: /etc/masakari/masakari.conf.d
name: masakari-etc-confd
{{- include "utils.trust_bundle.volume_mount" . | indent 8 }}
volumes:
- name: masakari-database
persistentVolumeClaim:
claimName: masakari-database
- name: masakari-etc
configMap:
name: masakari-etc
- name: masakari-etc-confd
secret:
secretName: masakari-etc
{{- include "utils.proxysql.volumes" . | indent 6 }}
{{- include "utils.trust_bundle.volumes" . | indent 6 }}
4 changes: 2 additions & 2 deletions openstack/masakari/templates/etc/_secrets.conf.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{{- include "ini_sections.default_transport_url" . }}

[database]
connection = {{ .Values.sqlite.connection }}
connection = {{ tuple . .Values.mariadb.name .Values.mariadb.users.masakari.name .Values.mariadb.users.masakari.password | include "db_url_mysql" }}

[keystone_authtoken]
username = masakari
password = {{ .Values.global.masakari_service_password }}

[taskflow]
connection = {{ .Values.sqlite.connection }}
connection = {{ tuple . .Values.mariadb.name .Values.mariadb.users.masakari.name .Values.mariadb.users.masakari.password | include "db_url_mysql" }}
1 change: 0 additions & 1 deletion openstack/masakari/templates/etc/_uwsgi.ini.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ master = true
memory-report = true
processes = {{ .Values.uwsgi.processes }}
wsgi-file = {{ .Values.uwsgi.wsgi_file }}

Loading

0 comments on commit b2f46f1

Please sign in to comment.