[COMMON] Update MariaDB readinessChecks to fix Operator issues
Give different readinessCheck rules depending on the usage
of mariaDB Operator and local/global DB setup
Apply these changes to CDS, NBI, SO, SDNC, Policy
Issue-ID: OOM-3280
Change-Id: I4e6f584558ffebb6ab602db88a73c2f02891902e
Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de>
diff --git a/kubernetes/policy/templates/job.yaml b/kubernetes/policy/templates/job.yaml
index 442314c..2a61429 100755
--- a/kubernetes/policy/templates/job.yaml
+++ b/kubernetes/policy/templates/job.yaml
@@ -36,26 +36,19 @@
imagePullSecrets:
- name: "{{ include "common.namespace" . }}-docker-registry-key"
initContainers:
- - name: {{ include "common.name" . }}-mariadb-readiness
- image: {{ include "repositoryGenerator.image.readiness" . }}
- imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
- command:
- - /app/ready.py
- - --app-name
- - {{ index .Values "mariadb-galera" "service" "name" }}
- env:
- - name: NAMESPACE
- valueFrom:
- fieldRef:
- apiVersion: v1
- fieldPath: metadata.namespace
- resources:
- limits:
- cpu: "100m"
- memory: "0.5Gi"
- requests:
- cpu: "3m"
- memory: "0.02Gi"
+ {{- if .Values.global.mariadbGalera.localCluster }}
+ {{- if .Values.global.mariadbGalera.useOperator }}
+ {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local_operator ) | indent 6 | trim }}
+ {{ else }}
+ {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }}
+ {{- end }}
+ {{ else }}
+ {{- if .Values.global.mariadbGalera.useOperator }}
+ {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global_operator ) | indent 6 | trim }}
+ {{ else }}
+ {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }}
+ {{- end }}
+ {{- end }}
containers:
- name: {{ include "common.name" . }}-galera-config
image: {{ include "repositoryGenerator.image.mariadb" . }}
diff --git a/kubernetes/policy/values.yaml b/kubernetes/policy/values.yaml
index 8dca11d..9d08080 100755
--- a/kubernetes/policy/values.yaml
+++ b/kubernetes/policy/values.yaml
@@ -275,6 +275,18 @@
readinessCheck:
wait_for:
- '{{ ternary .Values.postgres.service.name "postgres" .Values.global.postgres.localCluster }}'
+ wait_for_global_operator:
+ pods:
+ - '{{ .Values.global.mariadbGalera.nameOverride }}-0'
+ wait_for_local_operator:
+ pods:
+ - '{{ index .Values "mariadb-galera" "nameOverride" }}-0'
+ wait_for_global:
+ apps:
+ - '{{ include "common.mariadbAppName" . }}'
+ wait_for_local:
+ apps:
+ - '{{ include "common.mariadbAppName" . }}'
restServer:
policyPapUserName: policyadmin