aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Geissler <andreas-geissler@telekom.de>2024-03-11 17:26:53 +0100
committerAndreas Geissler <andreas-geissler@telekom.de>2024-03-11 17:31:04 +0100
commit060bc378e32c2ffba34f890c53cc359eb9ee64d0 (patch)
tree8bb7de0ab8445dc7fbbc8831f2ad6a09e9c83381
parent9964927d8766c5c396ef2caf6f7aeb7494db279e (diff)
[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>
-rwxr-xr-xkubernetes/cds/components/cds-blueprints-processor/templates/deployment.yaml14
-rwxr-xr-xkubernetes/cds/components/cds-blueprints-processor/values.yaml24
-rw-r--r--kubernetes/common/mariadb-init/Chart.yaml5
-rw-r--r--kubernetes/common/mariadb-init/templates/job.yaml34
-rw-r--r--kubernetes/common/mariadb-init/values.yaml14
-rwxr-xr-xkubernetes/policy/templates/job.yaml33
-rwxr-xr-xkubernetes/policy/values.yaml12
-rw-r--r--kubernetes/sdnc/Chart.yaml3
-rwxr-xr-xkubernetes/sdnc/templates/job.yaml34
-rw-r--r--kubernetes/sdnc/values.yaml14
-rwxr-xr-xkubernetes/so/components/so-mariadb/Chart.yaml3
-rw-r--r--kubernetes/so/components/so-mariadb/templates/job.yaml34
-rwxr-xr-xkubernetes/so/components/so-mariadb/values.yaml14
13 files changed, 151 insertions, 87 deletions
diff --git a/kubernetes/cds/components/cds-blueprints-processor/templates/deployment.yaml b/kubernetes/cds/components/cds-blueprints-processor/templates/deployment.yaml
index a6e3a52bf7..761b031770 100755
--- a/kubernetes/cds/components/cds-blueprints-processor/templates/deployment.yaml
+++ b/kubernetes/cds/components/cds-blueprints-processor/templates/deployment.yaml
@@ -37,7 +37,19 @@ spec:
metadata: {{- include "common.templateMetadata" . | nindent 6 }}
spec:
initContainers:
- {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
+ {{- 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 }}
- command:
- sh
args:
diff --git a/kubernetes/cds/components/cds-blueprints-processor/values.yaml b/kubernetes/cds/components/cds-blueprints-processor/values.yaml
index 3d931d3d65..a32afb0db3 100755
--- a/kubernetes/cds/components/cds-blueprints-processor/values.yaml
+++ b/kubernetes/cds/components/cds-blueprints-processor/values.yaml
@@ -18,6 +18,17 @@
# Global configuration defaults.
#################################################################
global:
+ mariadbGalera: &mariadbGalera
+ # flag to enable the DB creation via mariadb-operator
+ useOperator: true
+ #This flag allows NBI to instantiate its own mariadb-galera cluster
+ #When changing it to "true", also set "globalCluster: false"
+ #as the dependency check will not work otherwise (Chart.yaml)
+ localCluster: true
+ globalCluster: false
+ service: mariadb-galera
+ internalPort: 3306
+ nameOverride: mariadb-galera
# image pull policy
pullPolicy: Always
persistence:
@@ -218,9 +229,18 @@ resources:
unlimited: {}
readinessCheck:
- wait_for:
+ wait_for_global_operator:
+ pods:
+ - '{{ .Values.global.mariadbGalera.nameOverride }}-0'
+ wait_for_local_operator:
+ pods:
+ - '{{ .Values.config.cdsDB.dbServer }}-0'
+ wait_for_global:
apps:
- - cds-db
+ - '{{ .Values.global.mariadbGalera.nameOverride }}'
+ wait_for_local:
+ apps:
+ - '{{ .Values.config.cdsDB.dbServer }}'
#Pods Service Account
serviceAccount:
diff --git a/kubernetes/common/mariadb-init/Chart.yaml b/kubernetes/common/mariadb-init/Chart.yaml
index fe134578df..fa89a669d2 100644
--- a/kubernetes/common/mariadb-init/Chart.yaml
+++ b/kubernetes/common/mariadb-init/Chart.yaml
@@ -28,4 +28,7 @@ dependencies:
repository: 'file://../repositoryGenerator'
- name: serviceAccount
version: ~13.x-0
- repository: '@local' \ No newline at end of file
+ repository: '@local'
+ - name: readinessCheck
+ version: ~13.x-0
+ repository: '@local'
diff --git a/kubernetes/common/mariadb-init/templates/job.yaml b/kubernetes/common/mariadb-init/templates/job.yaml
index 288ea8e02e..0180fecf0e 100644
--- a/kubernetes/common/mariadb-init/templates/job.yaml
+++ b/kubernetes/common/mariadb-init/templates/job.yaml
@@ -37,27 +37,19 @@ spec:
name: {{ include "common.name" . }}
spec:
initContainers:
- - name: {{ include "common.name" . }}-readiness
- command:
- - /app/ready.py
- args:
- - --app-name
- - {{ default .Values.global.mariadbGalera.nameOverride .Values.mariadbGalera.containerName }}
- env:
- - name: NAMESPACE
- valueFrom:
- fieldRef:
- apiVersion: v1
- fieldPath: metadata.namespace
- image: {{ include "repositoryGenerator.image.readiness" . }}
- imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
- 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" . }}
image: {{ include "repositoryGenerator.image.mariadb" . }}
diff --git a/kubernetes/common/mariadb-init/values.yaml b/kubernetes/common/mariadb-init/values.yaml
index 9a4b4b369b..e0ba28266a 100644
--- a/kubernetes/common/mariadb-init/values.yaml
+++ b/kubernetes/common/mariadb-init/values.yaml
@@ -148,3 +148,17 @@ serviceAccount:
wait_for_job_container:
containers:
- '{{ include "common.name" . }}'
+
+readinessCheck:
+ 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" . }}'
diff --git a/kubernetes/policy/templates/job.yaml b/kubernetes/policy/templates/job.yaml
index 442314c435..2a61429544 100755
--- a/kubernetes/policy/templates/job.yaml
+++ b/kubernetes/policy/templates/job.yaml
@@ -36,26 +36,19 @@ spec:
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 8dca11d74b..9d08080cf7 100755
--- a/kubernetes/policy/values.yaml
+++ b/kubernetes/policy/values.yaml
@@ -275,6 +275,18 @@ postgres:
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
diff --git a/kubernetes/sdnc/Chart.yaml b/kubernetes/sdnc/Chart.yaml
index 622991562b..4a0c9eb607 100644
--- a/kubernetes/sdnc/Chart.yaml
+++ b/kubernetes/sdnc/Chart.yaml
@@ -72,3 +72,6 @@ dependencies:
- name: serviceAccount
version: ~13.x-0
repository: '@local'
+ - name: readinessCheck
+ version: ~13.x-0
+ repository: '@local'
diff --git a/kubernetes/sdnc/templates/job.yaml b/kubernetes/sdnc/templates/job.yaml
index 451c5b0453..db331143a9 100755
--- a/kubernetes/sdnc/templates/job.yaml
+++ b/kubernetes/sdnc/templates/job.yaml
@@ -76,27 +76,19 @@ spec:
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
name: {{ include "common.name" . }}-update-config
- - name: {{ include "common.name" . }}-readiness
- command:
- - /app/ready.py
- args:
- - --app-name
- - {{ include "common.mariadbAppName" . }}
- env:
- - name: NAMESPACE
- valueFrom:
- fieldRef:
- apiVersion: v1
- fieldPath: metadata.namespace
- image: {{ include "repositoryGenerator.image.readiness" . }}
- imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
- 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" . }}
image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
diff --git a/kubernetes/sdnc/values.yaml b/kubernetes/sdnc/values.yaml
index 55f6a1d7cd..1c7fa9eb0a 100644
--- a/kubernetes/sdnc/values.yaml
+++ b/kubernetes/sdnc/values.yaml
@@ -690,3 +690,17 @@ serviceAccount:
#Log configuration
log:
path: /var/log/onap
+
+readinessCheck:
+ 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" . }}'
diff --git a/kubernetes/so/components/so-mariadb/Chart.yaml b/kubernetes/so/components/so-mariadb/Chart.yaml
index cb82906ad1..f66f740b34 100755
--- a/kubernetes/so/components/so-mariadb/Chart.yaml
+++ b/kubernetes/so/components/so-mariadb/Chart.yaml
@@ -28,6 +28,9 @@ dependencies:
- name: repositoryGenerator
version: ~13.x-0
repository: '@local'
+ - name: readinessCheck
+ version: ~13.x-0
+ repository: '@local'
- name: serviceAccount
version: ~13.x-0
repository: '@local'
diff --git a/kubernetes/so/components/so-mariadb/templates/job.yaml b/kubernetes/so/components/so-mariadb/templates/job.yaml
index abbe5997ee..a2edf33272 100644
--- a/kubernetes/so/components/so-mariadb/templates/job.yaml
+++ b/kubernetes/so/components/so-mariadb/templates/job.yaml
@@ -102,27 +102,19 @@ spec:
name: {{ include "common.name" . }}
spec:
initContainers:
- - name: {{ include "common.name" . }}-readiness
- command:
- - /app/ready.py
- args:
- - --app-name
- - {{ include "common.mariadbAppName" . }}
- env:
- - name: NAMESPACE
- valueFrom:
- fieldRef:
- apiVersion: v1
- fieldPath: metadata.namespace
- image: {{ include "repositoryGenerator.image.readiness" . }}
- imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
- 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" . }}-config
image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
diff --git a/kubernetes/so/components/so-mariadb/values.yaml b/kubernetes/so/components/so-mariadb/values.yaml
index 38b4d3fe04..6fdfd75dde 100755
--- a/kubernetes/so/components/so-mariadb/values.yaml
+++ b/kubernetes/so/components/so-mariadb/values.yaml
@@ -207,3 +207,17 @@ serviceAccount:
wait_for_job_container:
containers:
- '{{ include "common.name" . }}-config'
+
+readinessCheck:
+ 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" . }}'