blob: 51263cf410d88aff3a2a90fbefb53283d65e50eb [file] [log] [blame]
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +01001{{/*
jmac7c434672018-05-11 20:14:17 +00002# Copyright © 2017 Amdocs, Bell Canada
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.
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010015*/}}
jmac7c434672018-05-11 20:14:17 +000016
Grzegorz-Lis1318a772020-07-23 15:08:43 +020017apiVersion: apps/v1
jmac7c434672018-05-11 20:14:17 +000018kind: Deployment
Alexander Dehn9b797d62020-04-21 09:53:50 +000019metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
jmac7c434672018-05-11 20:14:17 +000020spec:
Grzegorz-Lis1318a772020-07-23 15:08:43 +020021 selector:
22 matchLabels:
23 app: {{ include "common.name" . }}
jmac7c434672018-05-11 20:14:17 +000024 replicas: {{ .Values.replicaCount }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000025 selector: {{- include "common.selectors" . | nindent 4 }}
jmac7c434672018-05-11 20:14:17 +000026 template:
Alexander Dehn9b797d62020-04-21 09:53:50 +000027 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
jmac7c434672018-05-11 20:14:17 +000028 spec:
29 initContainers:
30 - command:
Krzysztof Opasiakb9d50c92020-02-20 21:29:45 +010031 - sh
32 args:
33 - -c
34 - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
35 env:
36 - name: DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010037 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
Krzysztof Opasiakb9d50c92020-02-20 21:29:45 +010038 - name: DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010039 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
Krzysztof Opasiakb9d50c92020-02-20 21:29:45 +010040 - name: REST_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010041 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "rest-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakb9d50c92020-02-20 21:29:45 +010042 - name: REST_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010043 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "rest-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakb9d50c92020-02-20 21:29:45 +010044 volumeMounts:
45 - mountPath: /config-input
46 name: config-input
47 - mountPath: /config
48 name: config
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010049 image: {{ include "repositoryGenerator.image.envsubst" . }}
Krzysztof Opasiakb9d50c92020-02-20 21:29:45 +010050 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
51 name: {{ include "common.name" . }}-update-config
52
53 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020054 - /app/ready.py
jmac7c434672018-05-11 20:14:17 +000055 args:
56 - --container-name
57 - {{ .Values.config.sdncChartName }}
58 env:
59 - name: NAMESPACE
60 valueFrom:
61 fieldRef:
62 apiVersion: v1
63 fieldPath: metadata.namespace
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010064 image: {{ include "repositoryGenerator.image.readiness" . }}
jmac7c434672018-05-11 20:14:17 +000065 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66 name: {{ include "common.name" . }}-readiness
67 containers:
68 - name: {{ include "common.name" . }}
Timoney, Dan (dt5972)3a2802f2019-02-20 13:58:24 -050069 command: ["/bin/bash"]
Dan Timoneyef2826f2021-09-20 11:37:06 -040070 args: ["-c", "cd /opt/ansible-server && ./startAnsibleServer.sh"]
Timoney, Dan (dt5972)3a2802f2019-02-20 13:58:24 -050071
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010072 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
jmac7c434672018-05-11 20:14:17 +000073 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
74 ports:
75 - containerPort: {{ .Values.service.internalPort }}
76 # disable liveness probe when breakpoints set in debugger
77 # so K8s doesn't restart unresponsive container
78 {{ if .Values.liveness.enabled }}
79 livenessProbe:
80 tcpSocket:
81 port: {{ .Values.service.internalPort }}
82 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
83 periodSeconds: {{ .Values.liveness.periodSeconds }}
84 {{ end }}
85 readinessProbe:
86 tcpSocket:
87 port: {{ .Values.service.internalPort }}
88 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
89 periodSeconds: {{ .Values.readiness.periodSeconds }}
90 volumeMounts:
91 - mountPath: /etc/localtime
92 name: localtime
93 readOnly: true
94 - mountPath: {{ .Values.config.configDir }}/RestServer_config
95 name: config
96 subPath: RestServer_config
Satoshi Fujii54bfd172021-07-04 16:39:41 +000097 resources: {{ include "common.resources" . | nindent 12 }}
98 {{- if .Values.nodeSelector }}
99 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
100 {{- end }}
101 {{- if .Values.affinity }}
102 affinity: {{ toYaml .Values.affinity | nindent 8 }}
103 {{- end }}
farida azmy32c5ed82021-08-04 14:46:09 +0200104 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
jmac7c434672018-05-11 20:14:17 +0000105 volumes:
106 - name: localtime
107 hostPath:
108 path: /etc/localtime
Krzysztof Opasiakb9d50c92020-02-20 21:29:45 +0100109 - name: config-input
jmac7c434672018-05-11 20:14:17 +0000110 configMap:
111 name: {{ include "common.fullname" . }}
112 defaultMode: 0644
Krzysztof Opasiakb9d50c92020-02-20 21:29:45 +0100113 - name: config
114 emptyDir:
115 medium: Memory
jmac7c434672018-05-11 20:14:17 +0000116 imagePullSecrets:
toshrajbhardwaj72b5f0f2018-09-13 02:45:22 +0000117 - name: "{{ include "common.namespace" . }}-docker-registry-key"