blob: add085f94df48c5afe7931d89a39d88919ee7d0c [file] [log] [blame]
jhhd4258672020-08-09 12:08:08 -05001# ============LICENSE_START=======================================================
2# Copyright (C) 2020 AT&T Intellectual Property.
3# ================================================================================
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16# SPDX-License-Identifier: Apache-2.0
17# ============LICENSE_END=========================================================
18
Grzegorz-Lis4fad3022020-07-31 10:18:21 +020019apiVersion: apps/v1
mmis9cb50292018-09-19 00:31:35 +010020kind: Deployment
21metadata:
22 name: {{ include "common.fullname" . }}
23 namespace: {{ include "common.namespace" . }}
24 labels:
25 app: {{ include "common.name" . }}
26 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010027 release: {{ include "common.release" . }}
mmis9cb50292018-09-19 00:31:35 +010028 heritage: {{ .Release.Service }}
29spec:
Grzegorz-Lis4fad3022020-07-31 10:18:21 +020030 selector:
31 matchLabels:
32 app: {{ include "common.name" . }}
mmis9cb50292018-09-19 00:31:35 +010033 replicas: {{ .Values.replicaCount }}
34 template:
35 metadata:
36 labels:
37 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010038 release: {{ include "common.release" . }}
mmis9cb50292018-09-19 00:31:35 +010039 spec:
Dominik Mizyn4aa534f2020-04-14 18:03:53 +020040 initContainers:
41 - command:
42 - sh
43 args:
44 - -c
45 - "cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done"
46 env:
47 - name: RESTSERVER_USER
48 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 10 }}
49 - name: RESTSERVER_PASSWORD
50 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 10 }}
51 - name: API_USER
52 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "apiparameters-creds" "key" "login") | indent 10 }}
53 - name: API_PASSWORD
54 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "apiparameters-creds" "key" "password") | indent 10 }}
55 - name: PAP_USER
56 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "papparameters-creds" "key" "login") | indent 10 }}
57 - name: PAP_PASSWORD
58 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "papparameters-creds" "key" "password") | indent 10 }}
59 - name: SDCBE_USER
60 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdcbe-creds" "key" "login") | indent 10 }}
61 - name: SDCBE_PASSWORD
62 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdcbe-creds" "key" "password") | indent 10 }}
63 volumeMounts:
64 - mountPath: /config-input
65 name: distributionconfig-input
66 - mountPath: /config
67 name: distributionconfig
68 image: "{{ .Values.global.envsubstImage }}"
69 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
70 name: {{ include "common.name" . }}-update-config
jhhd4258672020-08-09 12:08:08 -050071{{ include "common.certInitializer.initContainer" . | indent 6 }}
mmis9cb50292018-09-19 00:31:35 +010072 containers:
73 - name: {{ include "common.name" . }}
Julien Barbot665fdc12018-10-22 16:49:07 +020074 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
mmis9cb50292018-09-19 00:31:35 +010075 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
jhhd4258672020-08-09 12:08:08 -050076{{- if .Values.global.aafEnabled }}
77 command: ["bash","-c"]
78 args: ["source {{ .Values.certInitializer.credsPath }}/.ci;\
79 cp {{ .Values.certInitializer.credsPath }}/org.onap.policy.p12 ${POLICY_HOME}/etc/ssl/policy-keystore;\
80 /opt/app/policy/distribution/bin/policy-dist.sh /opt/app/policy/distribution/etc/mounted/config.json"]
81{{- else }}
mmis9cb50292018-09-19 00:31:35 +010082 command: ["/opt/app/policy/distribution/bin/policy-dist.sh"]
83 args: ["/opt/app/policy/distribution/etc/mounted/config.json"]
jhhd4258672020-08-09 12:08:08 -050084 env:
85 - name: KEYSTORE_PASSWD
86 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "keystore-password" "key" "password") | indent 12 }}
87 - name: TRUSTSTORE_PASSWD
88 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "truststore-password" "key" "password") | indent 12 }}
89{{- end }}
mmis9cb50292018-09-19 00:31:35 +010090 ports:
91 - containerPort: {{ .Values.service.internalPort }}
92 # disable liveness probe when breakpoints set in debugger
93 # so K8s doesn't restart unresponsive container
94 {{- if eq .Values.liveness.enabled true }}
95 livenessProbe:
96 tcpSocket:
97 port: {{ .Values.service.internalPort }}
98 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
99 periodSeconds: {{ .Values.liveness.periodSeconds }}
100 {{ end -}}
101 readinessProbe:
102 tcpSocket:
103 port: {{ .Values.service.internalPort }}
104 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
105 periodSeconds: {{ .Values.readiness.periodSeconds }}
106 volumeMounts:
jhhd4258672020-08-09 12:08:08 -0500107{{ include "common.certInitializer.volumeMount" . | indent 10 }}
mmis9cb50292018-09-19 00:31:35 +0100108 - mountPath: /etc/localtime
109 name: localtime
110 readOnly: true
111 - mountPath: /opt/app/policy/distribution/etc/mounted
112 name: distributionconfig
113 resources:
jhhd4258672020-08-09 12:08:08 -0500114{{ include "common.resources" . }}
mmis9cb50292018-09-19 00:31:35 +0100115 {{- if .Values.nodeSelector }}
116 nodeSelector:
117{{ toYaml .Values.nodeSelector | indent 10 }}
118 {{- end -}}
119 {{- if .Values.affinity }}
120 affinity:
121{{ toYaml .Values.affinity | indent 10 }}
122 {{- end }}
123 volumes:
jhhd4258672020-08-09 12:08:08 -0500124{{ include "common.certInitializer.volumes" . | indent 8 }}
mmis9cb50292018-09-19 00:31:35 +0100125 - name: localtime
126 hostPath:
127 path: /etc/localtime
Dominik Mizyn4aa534f2020-04-14 18:03:53 +0200128 - name: distributionconfig-input
mmis9cb50292018-09-19 00:31:35 +0100129 configMap:
130 name: {{ include "common.fullname" . }}-configmap
131 defaultMode: 0755
Dominik Mizyn4aa534f2020-04-14 18:03:53 +0200132 - name: distributionconfig
133 emptyDir:
134 medium: Memory
mmis9cb50292018-09-19 00:31:35 +0100135 imagePullSecrets:
136 - name: "{{ include "common.namespace" . }}-docker-registry-key"