From f51bbef3978f1176551d6891c7e583d128a0875a Mon Sep 17 00:00:00 2001 From: Andreas Geissler Date: Fri, 31 Mar 2023 12:07:23 +0200 Subject: [COMMON][OTHERS] Fix dependency conditions In case of local DB the "init" dependency is activated as the "not" condition is not working Issue-ID: OOM-3152 Signed-off-by: Andreas Geissler Change-Id: I27dba69a644bbcc2b61245c22784976ba7c66173 --- kubernetes/common/network-name-gen/Chart.yaml | 2 +- kubernetes/common/network-name-gen/values.yaml | 3 +++ kubernetes/contrib/components/ejbca/Chart.yaml | 2 +- kubernetes/contrib/components/ejbca/values.yaml | 5 ++++- kubernetes/holmes/Chart.yaml | 2 +- .../components/holmes-engine-mgmt/templates/deployment.yaml | 6 ++++-- kubernetes/holmes/components/holmes-engine-mgmt/values.yaml | 4 +++- .../holmes/components/holmes-rule-mgmt/templates/deployment.yaml | 6 ++++-- kubernetes/holmes/components/holmes-rule-mgmt/values.yaml | 4 +++- kubernetes/holmes/values.yaml | 4 ++++ kubernetes/modeling/components/modeling-etsicatalog/Chart.yaml | 2 +- .../components/modeling-etsicatalog/templates/deployment.yaml | 9 +++++++-- kubernetes/modeling/components/modeling-etsicatalog/values.yaml | 5 ++++- kubernetes/nbi/Chart.yaml | 2 +- kubernetes/nbi/values.yaml | 3 +++ 15 files changed, 44 insertions(+), 15 deletions(-) diff --git a/kubernetes/common/network-name-gen/Chart.yaml b/kubernetes/common/network-name-gen/Chart.yaml index 17eaa684d8..08d50145ec 100644 --- a/kubernetes/common/network-name-gen/Chart.yaml +++ b/kubernetes/common/network-name-gen/Chart.yaml @@ -33,4 +33,4 @@ dependencies: - name: mariadb-init version: ~12.x-0 repository: 'file://../mariadb-init' - condition: not global.mariadbGalera.localCluster \ No newline at end of file + condition: global.mariadbGalera.globalCluster \ No newline at end of file diff --git a/kubernetes/common/network-name-gen/values.yaml b/kubernetes/common/network-name-gen/values.yaml index dcf85fee39..8b8848b8aa 100644 --- a/kubernetes/common/network-name-gen/values.yaml +++ b/kubernetes/common/network-name-gen/values.yaml @@ -26,7 +26,10 @@ global: mariadbGalera: &mariadbGalera #This flag allows SO 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: false + globalCluster: true service: mariadb-galera internalPort: 3306 nameOverride: mariadb-galera diff --git a/kubernetes/contrib/components/ejbca/Chart.yaml b/kubernetes/contrib/components/ejbca/Chart.yaml index e8a0134298..5c7ec253ed 100644 --- a/kubernetes/contrib/components/ejbca/Chart.yaml +++ b/kubernetes/contrib/components/ejbca/Chart.yaml @@ -30,7 +30,7 @@ dependencies: - name: mariadb-init version: ~12.x-0 repository: '@local' - condition: not global.mariadbGalera.localCluster + condition: global.mariadbGalera.globalCluster - name: repositoryGenerator version: ~12.x-0 repository: '@local' diff --git a/kubernetes/contrib/components/ejbca/values.yaml b/kubernetes/contrib/components/ejbca/values.yaml index b777a7d388..c223f41f79 100644 --- a/kubernetes/contrib/components/ejbca/values.yaml +++ b/kubernetes/contrib/components/ejbca/values.yaml @@ -13,8 +13,11 @@ # limitations under the License. global: mariadbGalera: &mariadbGalera - #This flag allows EJBCA to instantiate its own mariadb-galera cluster + #This flag allows SO 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: false + globalCluster: true service: mariadb-galera internalPort: 3306 nameOverride: mariadb-galera diff --git a/kubernetes/holmes/Chart.yaml b/kubernetes/holmes/Chart.yaml index 971d81c614..8f8e91d47f 100644 --- a/kubernetes/holmes/Chart.yaml +++ b/kubernetes/holmes/Chart.yaml @@ -34,7 +34,7 @@ dependencies: - name: postgres-init version: ~12.x-0 repository: '@local' - condition: not global.postgres.localCluster + condition: global.postgres.globalCluster - name: holmes-rule-mgmt version: ~12.x-0 repository: 'file://components/holmes-rule-mgmt' diff --git a/kubernetes/holmes/components/holmes-engine-mgmt/templates/deployment.yaml b/kubernetes/holmes/components/holmes-engine-mgmt/templates/deployment.yaml index cdf5327eab..fdbca09be0 100644 --- a/kubernetes/holmes/components/holmes-engine-mgmt/templates/deployment.yaml +++ b/kubernetes/holmes/components/holmes-engine-mgmt/templates/deployment.yaml @@ -34,8 +34,10 @@ spec: metadata: {{- include "common.templateMetadata" . | nindent 6 }} spec: initContainers: - {{- if not .Values.global.postgres.localCluster }} - {{ include "common.readinessCheck.waitFor" . | indent 6 | trim }} + {{- if .Values.global.postgres.localCluster }} + {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }} + {{ else }} + {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }} {{- end }} - name: {{ include "common.name" . }}-env-config image: {{ include "repositoryGenerator.image.envsubst" . }} diff --git a/kubernetes/holmes/components/holmes-engine-mgmt/values.yaml b/kubernetes/holmes/components/holmes-engine-mgmt/values.yaml index c9c62e78a3..028ca8d71e 100644 --- a/kubernetes/holmes/components/holmes-engine-mgmt/values.yaml +++ b/kubernetes/holmes/components/holmes-engine-mgmt/values.yaml @@ -123,9 +123,11 @@ resources: unlimited: {} readinessCheck: - wait_for: + wait_for_global: jobs: - '{{ include "common.release" . }}-holmes-postgres-init-config-job' + wait_for_local: + - '{{ .Values.global.postgres.container.name }}' #Pods Service Account serviceAccount: diff --git a/kubernetes/holmes/components/holmes-rule-mgmt/templates/deployment.yaml b/kubernetes/holmes/components/holmes-rule-mgmt/templates/deployment.yaml index 05def922c4..db0eb16092 100644 --- a/kubernetes/holmes/components/holmes-rule-mgmt/templates/deployment.yaml +++ b/kubernetes/holmes/components/holmes-rule-mgmt/templates/deployment.yaml @@ -33,8 +33,10 @@ spec: metadata: {{- include "common.templateMetadata" . | nindent 6 }} spec: initContainers: - {{- if not .Values.global.postgres.localCluster }} - {{ include "common.readinessCheck.waitFor" . | indent 6 | trim }} + {{- if .Values.global.postgres.localCluster }} + {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }} + {{ else }} + {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }} {{- end }} - name: {{ include "common.name" . }}-env-config image: {{ include "repositoryGenerator.image.envsubst" . }} diff --git a/kubernetes/holmes/components/holmes-rule-mgmt/values.yaml b/kubernetes/holmes/components/holmes-rule-mgmt/values.yaml index bc6639f7dd..543b7aa52c 100644 --- a/kubernetes/holmes/components/holmes-rule-mgmt/values.yaml +++ b/kubernetes/holmes/components/holmes-rule-mgmt/values.yaml @@ -135,9 +135,11 @@ resources: unlimited: {} readinessCheck: - wait_for: + wait_for_global: jobs: - '{{ include "common.release" . }}-holmes-postgres-init-config-job' + wait_for_local: + - '{{ .Values.global.postgres.container.name }}' #Pods Service Account serviceAccount: diff --git a/kubernetes/holmes/values.yaml b/kubernetes/holmes/values.yaml index e8eb53d140..40c3d872ff 100644 --- a/kubernetes/holmes/values.yaml +++ b/kubernetes/holmes/values.yaml @@ -22,7 +22,11 @@ global: #Service Names of the postgres db to connect to. #Override it to dbc-pg if localCluster is enabled. postgres: + #This flag allows SO 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: false + globalCluster: true service: name: pgset name2: &postgres tcp-pgset-primary diff --git a/kubernetes/modeling/components/modeling-etsicatalog/Chart.yaml b/kubernetes/modeling/components/modeling-etsicatalog/Chart.yaml index a90c700a8e..b1f6c4105a 100644 --- a/kubernetes/modeling/components/modeling-etsicatalog/Chart.yaml +++ b/kubernetes/modeling/components/modeling-etsicatalog/Chart.yaml @@ -30,7 +30,7 @@ dependencies: - name: mariadb-init version: ~12.x-0 repository: '@local' - condition: not global.mariadbGalera.localCluster + condition: global.mariadbGalera.globalCluster - name: readinessCheck version: ~12.x-0 repository: '@local' diff --git a/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml b/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml index dd9c020c22..bfbff215db 100644 --- a/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml +++ b/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml @@ -41,8 +41,13 @@ spec: - command: - /app/ready.py args: - - -j - - "{{ include "common.release" . }}-{{ include "common.name" . }}-config-job" +{{- if .Values.global.mariadbGalera.localCluster }} + - --container-name + - {{ index .Values "mariadb-galera" "nameOverride" }} +{{- else }} + - --job-name + - {{ include "common.release" . }}-{{ include "common.name" . }}-config-job +{{- end }} env: - name: NAMESPACE valueFrom: diff --git a/kubernetes/modeling/components/modeling-etsicatalog/values.yaml b/kubernetes/modeling/components/modeling-etsicatalog/values.yaml index 21abce3dda..c2b0dcff7d 100644 --- a/kubernetes/modeling/components/modeling-etsicatalog/values.yaml +++ b/kubernetes/modeling/components/modeling-etsicatalog/values.yaml @@ -22,8 +22,11 @@ global: mountPath: /dockerdata-nfs mariadbGalera: - #This flag allows Modeling to instantiate its own mariadb-galera cluster + #This flag allows SO 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: false + globalCluster: true service: mariadb-galera internalPort: 3306 nameOverride: mariadb-galera diff --git a/kubernetes/nbi/Chart.yaml b/kubernetes/nbi/Chart.yaml index 5f277876a3..5365075b32 100644 --- a/kubernetes/nbi/Chart.yaml +++ b/kubernetes/nbi/Chart.yaml @@ -36,7 +36,7 @@ dependencies: - name: mariadb-init version: ~12.x-0 repository: '@local' - condition: not global.mariadbGalera.localCluster + condition: global.mariadbGalera.globalCluster - name: repositoryGenerator version: ~12.x-0 repository: '@local' diff --git a/kubernetes/nbi/values.yaml b/kubernetes/nbi/values.yaml index e2b7341b7c..fbdf1fe199 100644 --- a/kubernetes/nbi/values.yaml +++ b/kubernetes/nbi/values.yaml @@ -20,7 +20,10 @@ global: nodePortPrefix: 302 mariadbGalera: &mariadbGalera #This flag allows SO 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: false + globalCluster: true service: mariadb-galera internalPort: 3306 nameOverride: mariadb-galera -- cgit 1.2.3-korg