blob: a957acee9e914861f16f6dbb1b7b086f6af3d4be [file] [log] [blame]
Durgpal7ad40692018-08-03 07:28:36 +00001# Modifications Copyright © 2018 Amdocs,Bell Canada
Dominic Lunanuovae825fee2018-04-12 14:40:34 +00002#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010015apiVersion: apps/v1
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000016kind: Deployment
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010017metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000018spec:
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010019 selector: {{- include "common.selectors" . | nindent 4 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000020 replicas: {{ .Values.replicaCount }}
21 template:
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010022 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000023 spec:
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010024{{- if or .Values.global.aafEnabled .Values.PG.enabled }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000025 initContainers:
Krzysztof Opasiak03a125a2020-05-05 02:11:09 +020026 - command:
27 - sh
28 args:
29 - -c
30 - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
31 env:
32 - name: PG_USER
33 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
34 - name: PG_PASSWORD
35 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
36 volumeMounts:
37 - mountPath: /config-input
38 name: {{ include "common.name" . }}-config-input
39 - mountPath: /config
40 name: {{ include "common.name" . }}-config
41 image: "{{ .Values.global.envsubstImage }}"
42 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43 name: {{ include "common.name" . }}-update-config
44
efiacore62958b2019-09-27 16:54:36 +010045{{- if .Values.global.aafEnabled }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010046 - name: {{ include "common.name" . }}-aaf-readiness
47 command:
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000048 - /root/ready.py
49 args:
50 - --container-name
dglFromAttfb58a9d2019-04-12 20:12:26 +000051 - aaf-locate
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010052 - --container-name
53 - aaf-cm
54 - --container-name
55 - aaf-service
dglFromAttfb58a9d2019-04-12 20:12:26 +000056 env:
57 - name: NAMESPACE
58 valueFrom:
59 fieldRef:
60 apiVersion: v1
61 fieldPath: metadata.namespace
62 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
63 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010064 - name: {{ include "common.name" . }}-aaf-config
Ubuntu3d5d1802019-11-14 23:16:17 +000065 image: "{{ include "common.repository" . }}/{{ .Values.global.aafAgentImage }}"
66 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67 command: ["bash","-c","exec /opt/app/aaf_config/bin/agent.sh"]
68 volumeMounts:
69 - mountPath: {{ .Values.persistence.aafCredsPath }}
Dominic Lunanuovade7a02b2020-03-12 16:36:09 +000070 name: {{ include "common.name" . }}-aaf-config-vol
Ubuntu3d5d1802019-11-14 23:16:17 +000071 env:
72 - name: APP_FQI
73 value: "{{ .Values.aafConfig.fqi }}"
74 - name: aaf_locate_url
75 value: "https://aaf-locate.{{ .Release.Namespace }}:8095"
76 - name: aaf_locator_container
77 value: "{{ .Values.global.aafLocatorContainer }}"
78 - name: aaf_locator_container_ns
79 value: "{{ .Release.Namespace }}"
80 - name: aaf_locator_fqdn
81 value: "{{ .Values.aafConfig.fqdn }}"
82 - name: aaf_locator_public_fqdn
83 value: "{{.Values.aafConfig.publicFqdn}}"
84 - name: aaf_locator_app_ns
85 value: "{{ .Values.global.aafAppNs }}"
86 - name: DEPLOY_FQI
87 value: "{{ .Values.aafConfig.aafDeployFqi }}"
88 - name: DEPLOY_PASSWORD
89 valueFrom:
90 secretKeyRef:
91 name: {{ include "common.fullname" . }}-secret
92 key: aaf-deploy-password
93 - name: cadi_longitude
94 value: "{{ .Values.aafConfig.cadiLongitude }}"
95 - name: cadi_latitude
96 value: "{{ .Values.aafConfig.cadiLatitude }}"
Dominic Lunanuovade7a02b2020-03-12 16:36:09 +000097 - name: {{ include "common.name" . }}-permission-fixer
98 image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
99 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
100 volumeMounts:
101 - mountPath: {{ .Values.persistence.aafCredsPath }}
102 name: {{ include "common.name" . }}-aaf-config-vol
103 command: ["chown","-Rf","1000:1001", "/opt/app/"]
104# See AAF-425 for explanation of why this is needed.
105# This artifact is provisioned in AAF for both pks12 and jks format and apparently
106# the cadi library is not using the jks password on the jks keystore.
107# So, this attempts to "fix" the credential property file until this is fixed properly.
108 - name: {{ include "common.name" . }}-cred-fixer
109 image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
110 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
111 volumeMounts:
112 - mountPath: {{ .Values.persistence.aafCredsPath }}
113 name: {{ include "common.name" . }}-aaf-config-vol
114 command: ["/bin/sh"]
115 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" ]
116
efiacore62958b2019-09-27 16:54:36 +0100117{{- end }}
118{{- if .Values.PG.enabled }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100119 - name: {{ include "common.name" . }}-postgres-readiness
120 command:
dglFromAttfb58a9d2019-04-12 20:12:26 +0000121 - /root/ready.py
122 args:
123 - --container-name
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000124 - {{ .Values.postgres.nameOverride }}
125 env:
126 - name: NAMESPACE
127 valueFrom:
128 fieldRef:
129 apiVersion: v1
130 fieldPath: metadata.namespace
131 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
132 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100133{{- end }}
134{{- end }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000135 containers:
136 - name: {{ include "common.name" . }}
Dominic Lunanuovade7a02b2020-03-12 16:36:09 +0000137 image: "{{ .Values.repository }}/{{ .Values.image }}"
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000138 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100139 ports: {{ include "common.containerPorts" . | nindent 10 }}
efiacore62958b2019-09-27 16:54:36 +0100140 {{ if eq .Values.liveness.enabled true -}}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000141 livenessProbe:
142 httpGet:
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100143 port: {{ .Values.liveness.port }}
144 path: /webapi/topics
145 scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000146 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
dglFromAttec0918d2018-10-17 19:34:49 +0000147 periodSeconds: {{ .Values.liveness.periodSeconds }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100148 {{ end -}}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000149 readinessProbe:
150 httpGet:
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100151 port: {{ .Values.readiness.port }}
152 path: /webapi/topics
153 scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000154 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
155 periodSeconds: {{ .Values.readiness.periodSeconds }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000156 volumeMounts:
157 - mountPath: /etc/localtime
158 name: localtime
159 readOnly: true
Dominic Lunanuovade7a02b2020-03-12 16:36:09 +0000160 - mountPath: {{ .Values.persistence.aafCredsPath }}
161 name: {{ include "common.name" . }}-aaf-config-vol
dglFromAttec0918d2018-10-17 19:34:49 +0000162# NOTE: on the following several configMaps, careful to include / at end
163# since there may be more than one file in each mountPath
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000164 - name: {{ include "common.name" . }}-config
dglFromAtt82340072018-10-16 21:53:34 +0000165 mountPath: /opt/app/config/conf/
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100166 resources: {{ include "common.resources" . | nindent 12 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000167 {{- if .Values.nodeSelector }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100168 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000169 {{- end -}}
170 {{- if .Values.affinity }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100171 affinity: {{ toYaml .Values.affinity | nindent 10 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000172 {{- end }}
173 volumes:
174 - name: localtime
175 hostPath:
176 path: /etc/localtime
Krzysztof Opasiak03a125a2020-05-05 02:11:09 +0200177 - name: {{ include "common.name" . }}-config-input
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000178 configMap:
179 name: {{ include "common.fullname" . }}-config
Dominic Lunanuovade7a02b2020-03-12 16:36:09 +0000180 - name: {{ include "common.name" . }}-aaf-config-vol
181 emptyDir: {}
Krzysztof Opasiak03a125a2020-05-05 02:11:09 +0200182 - name: {{ include "common.name" . }}-config
183 emptyDir:
184 medium: Memory
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000185 imagePullSecrets:
186 - name: "{{ include "common.namespace" . }}-docker-registry-key"