[DMAAP] DMaaP ServiceMesh compatibility
[oom.git] / kubernetes / dmaap / components / dmaap-bc / templates / deployment.yaml
index 2cfa373..a0c3154 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Modifications Copyright © 2018 Amdocs,Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
 apiVersion: apps/v1
 kind: Deployment
@@ -21,7 +23,8 @@ spec:
   template:
     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
     spec:
-{{- if or .Values.global.aafEnabled .Values.PG.enabled }}
+      {{ include "common.podSecurityContext" . | indent 6 | trim}}
+{{- if .Values.PG.enabled }}
       initContainers:
       - command:
         - sh
@@ -38,16 +41,15 @@ spec:
           name: {{ include "common.name" . }}-config-input
         - mountPath: /config
           name: {{ include "common.name" . }}-config
-        image: "{{ .Values.global.envsubstImage }}"
+        image: {{ include "repositoryGenerator.image.envsubst" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-update-config
-
-{{- if .Values.global.aafEnabled }}
-
 {{ include "common.certInitializer.initContainer" . | nindent 6 }}
-
+{{- if .Values.global.aafEnabled }}
       - name: {{ include "common.name" . }}-permission-fixer
-        image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
+        securityContext:
+          runAsUser: 0
+        image: {{ include "repositoryGenerator.image.busybox" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
         command: ["chown","-Rf","1000:1001", "/opt/app/"]
@@ -56,33 +58,37 @@ spec:
 #       the cadi library is not using the jks password on the jks keystore.
 #       So, this attempts to "fix" the credential property file until this is fixed properly.
       - name: {{ include "common.name" . }}-cred-fixer
-        image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
+        image: {{ include "repositoryGenerator.image.busybox" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
         command: ["/bin/sh"]
         args: [ "-c", "sed -i -e '/cadi_keystore_password=/d' -e '/cadi_keystore_password_jks/p' -e 's/cadi_keystore_password_jks/cadi_keystore_password/' -e 's/dmaap-bc.p12/dmaap-bc.jks/' /opt/app/osaaf/local/org.onap.dmaap-bc.cred.props" ]
-
 {{- end }}
-{{- if .Values.PG.enabled }}
       - name: {{ include "common.name" . }}-postgres-readiness
+        securityContext:
+          runAsUser: 100
+          runAsGroup: 65533
         command:
-        - /root/ready.py
+        - /app/ready.py
         args:
         - --container-name
         - {{ .Values.postgres.nameOverride }}
+        - --container-name
+        - message-router
+        - --container-name
+        - dmaap-dr-node
         env:
         - name: NAMESPACE
           valueFrom:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-{{- end }}
 {{- end }}
       containers:
         - name: {{ include "common.name" . }}
-          image: "{{ .Values.repository }}/{{ .Values.image }}"
+          image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           ports: {{ include "common.containerPorts" . | nindent 10  }}
           {{ if eq .Values.liveness.enabled true -}}
@@ -116,6 +122,7 @@ spec:
         {{- if .Values.affinity }}
         affinity: {{ toYaml .Values.affinity | nindent 10 }}
         {{- end }}
+      serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
         - name: localtime
           hostPath: