[SO] Use readiness check job support 26/116226/4
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Tue, 8 Dec 2020 17:03:50 +0000 (18:03 +0100)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Mon, 14 Dec 2020 15:58:05 +0000 (16:58 +0100)
CNF Adapter needs to wait for mariadb config job to be performed.

Unfortunately, when we deploy using gating, the repositoryOverride makes
the pod to use a wrong image.

With readinessCheck job support, we don't have this issue anymore

Issue-ID: SO-3416
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: I0ef79cdc46bc3dbd55988d3d1ad601ed9c6a4cdb

kubernetes/so/components/so-cnf-adapter/requirements.yaml
kubernetes/so/components/so-cnf-adapter/templates/deployment.yaml
kubernetes/so/components/so-cnf-adapter/values.yaml

index 3e953c0..c9af7f9 100755 (executable)
@@ -19,6 +19,9 @@ dependencies:
     # a part of this chart's package and will not
     # be published independently to a repo (at this point)
     repository: '@local'
+  - name: readinessCheck
+    version: ~7.x-0
+    repository: '@local'
   - name: repositoryGenerator
     version: ~7.x-0
     repository: '@local'
index 3c13132..4518a5f 100755 (executable)
@@ -50,20 +50,7 @@ spec:
           volumeMounts:
             - name: encoder
               mountPath: /output
-        - name: {{ include "common.name" . }}-readiness
-          command:
-            - /app/ready.py
-          args:
-            - --job-name
-            - {{ include "common.release" . }}-so-mariadb-config-job
-          env:
-            - name: NAMESPACE
-              valueFrom:
-                fieldRef:
-                  apiVersion: v1
-                  fieldPath: metadata.namespace
-          image: {{ include "repositoryGenerator.image.readiness" . }}
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        {{ include "common.readinessCheck.waitFor" . | indent 8 | trim }}
       containers:
         - name: {{ include "common.name" . }}
           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
index 0fdd4f2..edd3738 100755 (executable)
@@ -76,6 +76,12 @@ secrets:
 #################################################################
 image: onap/so/mso-cnf-adapter:1.7.1
 pullPolicy: Always
+
+readinessCheck:
+  wait_for:
+    jobs:
+      - '{{ include "common.release" . }}-so-mariadb-config-job'
+
 db:
   userName: so_user
   userPassword: so_User123