Add dcaemod charts
[oom.git] / kubernetes / dcaemod / components / dcaemod-onboarding-api / templates / deployment.yaml
1 #============LICENSE_START========================================================
2 # ================================================================================
3 # Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ============LICENSE_END=========================================================
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
21 spec:
22   replicas: 1
23   selector: {{- include "common.selectors" . | nindent 4 }}
24   template:
25     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
26     spec:
27       initContainers:
28        - name: {{ include "common.name" . }}-readiness
29          image: {{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}
30          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
31          command:
32           - /root/ready.py
33          args:
34            - --container-name
35            - {{ .Values.postgres.nameOverride }}
36            - "-t"
37            - "15"
38          env:
39          - name: NAMESPACE
40            valueFrom:
41              fieldRef:
42                apiVersion: v1
43                fieldPath: metadata.namespace
44       containers:
45         - name: {{ include "common.name" . }}
46           command:
47             - sh
48           args:
49             - -c
50             - 'PG_CONN=postgresql://${PG_USER}:${PG_PASSWORD}@${PG_ADDR}:${PG_PORT}/${PG_DB_NAME} ./start.sh'
51           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
52           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53           ports: {{ include "common.containerPorts" . | nindent 12  }}
54           {{- if eq .Values.liveness.enabled true }}
55           livenessProbe:
56             tcpSocket:
57               port: {{ .Values.liveness.port }}
58             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
59             periodSeconds: {{ .Values.liveness.periodSeconds }}
60           {{ end }}
61           readinessProbe:
62             tcpSocket:
63               port: {{ .Values.readiness.port }}
64             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
65             periodSeconds: {{ .Values.readiness.periodSeconds }}
66           resources: {{ include "common.resources" . | nindent 12 }}
67           env:
68             - name: PG_ADDR
69               value: {{ .Values.postgres.service.name2 }}
70               # This should be kept in secret but it needs a fix in postgres common chart
71             - name: PG_USER
72               value: postgres
73             - name: PG_PASSWORD
74               {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-root-pass" "key" "password") | indent 14 }}
75             - name: PG_PORT
76               value: "5432"
77             - name: PG_DB_NAME
78               value: dcae_onboarding_db
79       imagePullSecrets:
80         - name: "{{ include "common.namespace" . }}-docker-registry-key"