[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / oof / templates / deployment.yaml
index ed64166..750c3d1 100644 (file)
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-apiVersion: extensions/v1beta1
+apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: {{ include "common.fullname" . }}
@@ -21,33 +21,53 @@ metadata:
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
+  selector:
+    matchLabels:
+      app: {{ include "common.name" . }}
   replicas: {{ .Values.replicaCount }}
   template:
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
       - command:
-        - /root/ready.py
+        - /app/ready.py
         args:
         - --container-name
-        - pdp
-        - --container-name
-        - oof-has-api
+        - policy-xacml-pdp
         env:
         - name: NAMESPACE
           valueFrom:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-readiness
+      - command:
+        - sh
+        - -c
+        - resp="FAILURE";
+          until [ $resp = "200" ]; do
+          resp=$(curl -s -o /dev/null -k --write-out %{http_code} https://aaf-sms.{{ include "common.namespace" . }}:10443/v1/sms/domain/osdf/secret);
+          echo $resp;
+          sleep 2;
+          done
+        env:
+        - name: NAMESPACE
+          valueFrom:
+            fieldRef:
+              apiVersion: v1
+              fieldPath: metadata.namespace
+        image: "{{ .Values.global.dockerHubRepository }}/{{ .Values.global.curlImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        name: {{ include "common.name" . }}-osdf-sms-readiness
+
       containers:
         - name: {{ include "common.name" . }}
           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
@@ -73,9 +93,21 @@ spec:
           - mountPath: /etc/localtime
             name: localtime
             readOnly: true
-          - mountPath: /opt/app/config/osdf_config.yaml
+          - mountPath: /opt/osdf/config/osdf_config.yaml
             name: {{ include "common.fullname" . }}-config
             subPath: osdf_config.yaml
+          - mountPath: /opt/app/ssl_cert/aaf_root_ca.cer
+            name: {{ include "common.fullname" . }}-config
+            subPath: aaf_root_ca.cer
+          - mountPath: /opt/app/ssl_cert/org.onap.oof.crt
+            name: {{ include "common.fullname" . }}-config
+            subPath: org.onap.oof.crt
+          - mountPath: /opt/app/ssl_cert/org.onap.oof.key
+            name: {{ include "common.fullname" . }}-config
+            subPath: org.onap.oof.key
+          - mountPath: /opt/osdf/config/common_config.yaml
+            name: {{ include "common.fullname" . }}-config
+            subPath: common_config.yaml
           resources:
 {{ include "common.resources" . | indent 12 }}
         {{- if .Values.nodeSelector }}
@@ -97,5 +129,13 @@ spec:
             items:
             - key: osdf_config.yaml
               path: osdf_config.yaml
+            - key: aaf_root_ca.cer
+              path: aaf_root_ca.cer
+            - key: common_config.yaml
+              path: common_config.yaml
+            - key: org.onap.oof.crt
+              path: org.onap.oof.crt
+            - key: org.onap.oof.key
+              path: org.onap.oof.key
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"