blob: 5a43fc71b089e6fdeef8d6faafba63969b73e8d4 [file] [log] [blame]
ktimoneyb3aef7b2021-09-13 08:27:58 +01001{{/*
2# ============LICENSE_START=======================================================
danielhanrahan88326642022-02-28 14:08:08 +00003# Copyright (C) 2021-2022 Nordix Foundation.
ktimoneyb3aef7b2021-09-13 08:27:58 +01004# ================================================================================
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#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
19*/}}
20
21apiVersion: apps/v1
22kind: Deployment
23metadata:
24 name: {{ include "common.fullname" . }}
25 namespace: {{ include "common.namespace" . }}
26 labels:
27 app: {{ include "common.name" . }}
28 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
29 release: {{ include "common.release" . }}
30 heritage: {{ .Release.Service }}
31spec:
32 replicas: {{ .Values.replicaCount }}
33 selector:
34 matchLabels:
35 app: {{ include "common.name" . }}
36 template:
37 metadata:
38 labels:
39 app: {{ include "common.name" . }}
40 release: {{ include "common.release" . }}
41 spec:
42 initContainers:
43 - command:
amatthews736bf372021-12-14 16:04:15 +000044 - sh
45 args:
46 - -c
47 - "cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done"
48 env:
49 - name: KEYSTORE
50 value: {{ .Values.certStores.keystoreLocation }}
51 - name: KEYSTORE_PASSWD
52 value: {{ .Values.certStores.keyStorePassword }}
53 - name: TRUSTSTORE
54 value: {{ .Values.certStores.truststoreLocation }}
55 - name: TRUSTSTORE_PASSWD
56 value: {{ .Values.certStores.trustStorePassword }}
57 - name: POLICY_LOGS
58 value: {{ .Values.log.path }}
59 volumeMounts:
60 - mountPath: /config-input
61 name: policy-gui-config
62 - mountPath: /config
63 name: policy-gui-config-processed
64 image: {{ include "repositoryGenerator.image.envsubst" . }}
65 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66 name: {{ include "common.name" . }}-update-config
67 - command:
ktimoneyb3aef7b2021-09-13 08:27:58 +010068 - /app/ready.py
69 args:
70 - --container-name
amatthews736bf372021-12-14 16:04:15 +000071 - policy-clamp-runtime-acm
ktimoneyb3aef7b2021-09-13 08:27:58 +010072 env:
73 - name: NAMESPACE
74 valueFrom:
75 fieldRef:
76 apiVersion: v1
77 fieldPath: metadata.namespace
78 image: {{ include "repositoryGenerator.image.readiness" . }}
79 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
80 name: {{ include "common.name" . }}-readiness
81{{ include "common.certInitializer.initContainer" . | nindent 6 }}
82 containers:
83 # side car containers
84 {{ if .Values.global.centralizedLoggingEnabled }}{{ include "common.log.sidecar" . | nindent 8 }}{{ end }}
85 # main container
86 - name: {{ include "common.name" . }}
87 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
88 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
amatthews736bf372021-12-14 16:04:15 +000089{{- if not (include "common.onServiceMesh" .) }}
danielhanrahan88326642022-02-28 14:08:08 +000090 command: ["sh","-c"]
91 args: ["source {{ .Values.certInitializer.credsPath }}/.ci;/opt/app/policy/gui/bin/policy-gui.sh"]
92 env:
amatthews736bf372021-12-14 16:04:15 +000093{{ else }}
danielhanrahan88326642022-02-28 14:08:08 +000094 command: ["/opt/app/policy/gui/bin/policy-gui.sh"]
95 env:
96 - name: KEYSTORE_PASSWD
97 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "keystore-password" "key" "password") | indent 12 }}
98 - name: TRUSTSTORE_PASSWD
99 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "truststore-password" "key" "password") | indent 12 }}
amatthews736bf372021-12-14 16:04:15 +0000100{{ end }}
danielhanrahan88326642022-02-28 14:08:08 +0000101 - name: CLAMP_URL
amatthews736bf372021-12-14 16:04:15 +0000102 value: http://policy-clamp-runtime-acm:6969
ktimoneyb3aef7b2021-09-13 08:27:58 +0100103 ports:
104 - containerPort: {{ .Values.service.internalPort }}
105 # disable liveness probe when breakpoints set in debugger
106 # so K8s doesn't restart unresponsive container
107 {{- if eq .Values.liveness.enabled true }}
108 livenessProbe:
109 tcpSocket:
110 port: {{ .Values.service.internalPort }}
111 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
112 periodSeconds: {{ .Values.liveness.periodSeconds }}
113 {{ end -}}
114 readinessProbe:
115 tcpSocket:
116 port: {{ .Values.service.internalPort }}
117 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
118 periodSeconds: {{ .Values.readiness.periodSeconds }}
119 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
120 - name: logs
121 mountPath: {{ .Values.log.path }}
amatthews736bf372021-12-14 16:04:15 +0000122 - mountPath: /opt/app/policy/gui/etc/application.yml
123 name: policy-gui-config-processed
124 subPath: application.yml
125 - mountPath: /opt/app/policy/gui/etc/logback.xml
126 name: policy-gui-config-processed
127 subPath: logback.xml
ktimoneyb3aef7b2021-09-13 08:27:58 +0100128 resources:
129{{ include "common.resources" . | indent 12 }}
130 {{- if .Values.nodeSelector }}
131 nodeSelector:
132{{ toYaml .Values.nodeSelector | indent 10 }}
133 {{- end -}}
134 {{- if .Values.affinity }}
135 affinity:
136{{ toYaml .Values.affinity | indent 10 }}
137 {{- end }}
138 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
139 volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
140 - name: {{ include "common.fullname" . }}-config
141 configMap:
142 name: {{ include "common.fullname" . }}
ktimoneyb3aef7b2021-09-13 08:27:58 +0100143 - name: logs
144 emptyDir: {}
145 {{ if .Values.global.centralizedLoggingEnabled }}{{ include "common.log.volumes" . | nindent 8 }}{{ end }}
amatthews736bf372021-12-14 16:04:15 +0000146 - name: policy-gui-config
147 configMap:
148 name: {{ include "common.fullname" . }}-configmap
149 defaultMode: 0755
150 - name: policy-gui-config-processed
151 emptyDir:
152 medium: Memory
ktimoneyb3aef7b2021-09-13 08:27:58 +0100153 imagePullSecrets:
154 - name: "{{ include "common.namespace" . }}-docker-registry-key"