Merge "[COMMON] Add limits to timescale db"
[oom.git] / kubernetes / dcaegen2 / components / dcae-inventory-api / templates / deployment.yaml
index 6769c00..7c3746a 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 #============LICENSE_START========================================================
 # ================================================================================
 # Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
@@ -14,8 +15,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # ============LICENSE_END=========================================================
+*/}}
 
-apiVersion: extensions/v1beta1
+apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: {{ include "common.fullname" . }}
@@ -27,6 +29,9 @@ metadata:
     heritage: {{ .Release.Service }}
 spec:
   replicas: 1
+  selector:
+    matchLabels:
+      app: {{ include "common.name" . }}
   template:
     metadata:
       labels:
@@ -34,14 +39,35 @@ spec:
         release: {{ include "common.release" . }}
     spec:
       initContainers:
+        - command:
+          - sh
+          args:
+          - -c
+          - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
+          env:
+          - name: PG_USER
+            {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 12 }}
+          - name: PG_PASSWORD
+            {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 12 }}
+          volumeMounts:
+          - mountPath: /config-input
+            name: {{ include "common.fullname" . }}-inv-config-input
+          - mountPath: /config
+            name: {{ include "common.fullname" . }}-inv-config
+          image: {{ include "repositoryGenerator.image.envsubst" . }}
+          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+          name: {{ include "common.name" . }}-update-config
+
         - name: {{ include "common.name" . }}-readiness
-          image: {{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}
+          image: {{ include "repositoryGenerator.image.readiness" . }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command:
-            - /root/ready.py
+            - /app/ready.py
           args:
             - --container-name
             - {{ .Values.postgres.nameOverride }}
+            - --container-name
+            - aaf-cm
             - "-t"
             - "15"
           env:
@@ -59,7 +85,7 @@ spec:
               fieldRef:
                 apiVersion: v1
                 fieldPath: status.podIP
-          image: {{ .Values.global.tlsRepository }}/{{ .Values.global.tlsImage }}
+          image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.tlsImage }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           resources: {}
           volumeMounts:
@@ -67,7 +93,7 @@ spec:
               name: tls-info
       containers:
         - name: {{ include "common.name" . }}
-          image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+          image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           # Assumes that the Docker image is built with ENTRYPOINT set to
           # ["java", "-jar", "/opt/inventory-api-x.y.z.jar", "server"]
@@ -115,7 +141,7 @@ spec:
                 fieldRef:
                   apiVersion: v1
                   fieldPath: status.podIP
-          image: {{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}
+          image: {{ include "repositoryGenerator.image.logging" . }}
           imagePullPolicy: IfNotPresent
           resources: {}
           volumeMounts:
@@ -126,6 +152,7 @@ spec:
           - mountPath: /usr/share/filebeat/filebeat.yml
             name: filebeat-conf
             subPath: filebeat.yml
+      serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
       volumes:
         - emptyDir: {}
           name: component-log
@@ -135,11 +162,13 @@ spec:
             defaultMode: 420
             name: {{ include "common.fullname" . }}-filebeat-configmap
           name: filebeat-conf
-        - name: {{ include "common.fullname" . }}-inv-config
+        - name: {{ include "common.fullname" . }}-inv-config-input
           configMap:
             name: {{ include "common.fullname" . }}-configmap
+        - name: {{ include "common.fullname" . }}-inv-config
+          emptyDir:
+            medium: Memory
         - emptyDir: {}
           name: tls-info
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
-