[POLICY] certInit support + refactoring
[oom.git] / kubernetes / policy / components / policy-drools-pdp / templates / statefulset.yaml
old mode 100644 (file)
new mode 100755 (executable)
similarity index 80%
rename from kubernetes/policy/charts/drools/templates/statefulset.yaml
rename to kubernetes/policy/components/policy-drools-pdp/templates/statefulset.yaml
index dd813b4..dc917ce
@@ -1,5 +1,5 @@
 # Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018-2019 AT&T
+# Modifications Copyright © 2018-2020 AT&T Intellectual Property
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -36,13 +36,26 @@ spec:
         release: {{ include "common.release" . }}
     spec:
       initContainers:
+      - command:
+        - /root/job_complete.py
+        args:
+        - --job-name
+        - {{ include "common.release" . }}-policy-galera-config
+        env:
+        - name: NAMESPACE
+          valueFrom:
+            fieldRef:
+              apiVersion: v1
+              fieldPath: metadata.namespace
+        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        name: {{ include "common.name" . }}-db-readiness
+{{- if not .Values.nexus.offline }}
       - command:
         - /root/ready.py
         args:
         - --container-name
-        - {{ include "common.release" . }}-galera-config
-        - --container-name
-        - {{ .Values.global.nexus.nameOverride }}
+        - {{ .Values.nexus.name }}
         env:
         - name: NAMESPACE
           valueFrom:
@@ -52,10 +65,16 @@ spec:
         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-readiness
+{{- end }}
+{{ include "common.certInitializer.initContainer" . | indent 6 }}
       containers:
         - name: {{ include "common.name" . }}
           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+          command: ["bash","-c"]
+          args: ["if [ -f {{ .Values.certInitializer.credsPath }}/.ci ]; then \
+                  source {{ .Values.certInitializer.credsPath }}/.ci; fi;\
+                  /opt/app/policy/bin/pdpd-cl-entrypoint.sh boot"]
           ports:
           - containerPort: {{ .Values.service.externalPort }}
           - containerPort: {{ .Values.service.externalPort2 }}
@@ -79,6 +98,7 @@ spec:
           - name: SQL_PASSWORD
             {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
           volumeMounts:
+{{ include "common.certInitializer.volumeMount" . | indent 10 }}
           - mountPath: /etc/localtime
             name: localtime
             readOnly: true
@@ -92,22 +112,9 @@ spec:
             name: drools-config
             subPath: {{ base $path }}
           {{- end }}
-          - mountPath: /var/log/onap
-            name: policy-logs
           resources:
-{{ include "common.resources" . | indent 12 }}
+{{ include "common.resources" . }}
         {{- if .Values.nodeSelector }}
-        - image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.loggingImage }}"
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          name: filebeat-onap
-          volumeMounts:
-          - mountPath: /usr/share/filebeat/filebeat.yml
-            name: filebeat-conf
-            subPath: filebeat.yml
-          - mountPath: /var/log/onap
-            name: policy-logs
-          - mountPath: /usr/share/filebeat/data
-            name: policy-data-filebeat
         nodeSelector:
 {{ toYaml .Values.nodeSelector | indent 10 }}
         {{- end -}}
@@ -116,16 +123,10 @@ spec:
 {{ toYaml .Values.affinity | indent 10 }}
         {{- end }}
       volumes:
+{{ include "common.certInitializer.volumes" . | indent 8 }}
         - name: localtime
           hostPath:
             path: /etc/localtime
-        - name: filebeat-conf
-          configMap:
-            name: {{ include "common.release" . }}-filebeat-configmap
-        - name: policy-logs
-          emptyDir: {}
-        - name: policy-data-filebeat
-          emptyDir: {}
         - name: drools-config
           configMap:
             name: {{ include "common.fullname" . }}-configmap