blob: 7a573d0356c47c5ca703bb6c6e627e5feac0b1b6 [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
Andreas Geisslerf10c5552023-03-21 18:09:46 +010023metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
ktimoneyb3aef7b2021-09-13 08:27:58 +010024spec:
Andreas Geisslerf10c5552023-03-21 18:09:46 +010025 selector: {{- include "common.selectors" . | nindent 4 }}
ktimoneyb3aef7b2021-09-13 08:27:58 +010026 replicas: {{ .Values.replicaCount }}
ktimoneyb3aef7b2021-09-13 08:27:58 +010027 template:
Andreas Geisslerf10c5552023-03-21 18:09:46 +010028 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
ktimoneyb3aef7b2021-09-13 08:27:58 +010029 spec:
30 initContainers:
31 - command:
amatthews736bf372021-12-14 16:04:15 +000032 - sh
33 args:
34 - -c
35 - "cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done"
36 env:
amatthews736bf372021-12-14 16:04:15 +000037 - name: POLICY_LOGS
38 value: {{ .Values.log.path }}
39 volumeMounts:
40 - mountPath: /config-input
41 name: policy-gui-config
42 - mountPath: /config
43 name: policy-gui-config-processed
44 image: {{ include "repositoryGenerator.image.envsubst" . }}
45 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
46 name: {{ include "common.name" . }}-update-config
47 - command:
ktimoneyb3aef7b2021-09-13 08:27:58 +010048 - /app/ready.py
49 args:
50 - --container-name
amatthews736bf372021-12-14 16:04:15 +000051 - policy-clamp-runtime-acm
ktimoneyb3aef7b2021-09-13 08:27:58 +010052 env:
53 - name: NAMESPACE
54 valueFrom:
55 fieldRef:
56 apiVersion: v1
57 fieldPath: metadata.namespace
58 image: {{ include "repositoryGenerator.image.readiness" . }}
59 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60 name: {{ include "common.name" . }}-readiness
ktimoneyb3aef7b2021-09-13 08:27:58 +010061 containers:
62 # side car containers
63 {{ if .Values.global.centralizedLoggingEnabled }}{{ include "common.log.sidecar" . | nindent 8 }}{{ end }}
64 # main container
65 - name: {{ include "common.name" . }}
66 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
67 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
danielhanrahan88326642022-02-28 14:08:08 +000068 command: ["/opt/app/policy/gui/bin/policy-gui.sh"]
69 env:
danielhanrahan88326642022-02-28 14:08:08 +000070 - name: CLAMP_URL
amatthews736bf372021-12-14 16:04:15 +000071 value: http://policy-clamp-runtime-acm:6969
ktimoneyb3aef7b2021-09-13 08:27:58 +010072 ports:
73 - containerPort: {{ .Values.service.internalPort }}
74 # disable liveness probe when breakpoints set in debugger
75 # so K8s doesn't restart unresponsive container
76 {{- if eq .Values.liveness.enabled true }}
77 livenessProbe:
78 tcpSocket:
79 port: {{ .Values.service.internalPort }}
80 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
81 periodSeconds: {{ .Values.liveness.periodSeconds }}
82 {{ end -}}
83 readinessProbe:
84 tcpSocket:
85 port: {{ .Values.service.internalPort }}
86 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
87 periodSeconds: {{ .Values.readiness.periodSeconds }}
Andreas Geisslerf10c5552023-03-21 18:09:46 +010088 volumeMounts:
ktimoneyb3aef7b2021-09-13 08:27:58 +010089 - name: logs
90 mountPath: {{ .Values.log.path }}
amatthews736bf372021-12-14 16:04:15 +000091 - mountPath: /opt/app/policy/gui/etc/application.yml
92 name: policy-gui-config-processed
93 subPath: application.yml
94 - mountPath: /opt/app/policy/gui/etc/logback.xml
95 name: policy-gui-config-processed
96 subPath: logback.xml
miroslavmasaryka7ac7f02023-03-01 14:12:26 +010097 resources: {{ include "common.resources" . | nindent 12 }}
ktimoneyb3aef7b2021-09-13 08:27:58 +010098 {{- if .Values.nodeSelector }}
99 nodeSelector:
100{{ toYaml .Values.nodeSelector | indent 10 }}
101 {{- end -}}
102 {{- if .Values.affinity }}
103 affinity:
104{{ toYaml .Values.affinity | indent 10 }}
105 {{- end }}
106 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Andreas Geisslerf10c5552023-03-21 18:09:46 +0100107 volumes:
ktimoneyb3aef7b2021-09-13 08:27:58 +0100108 - name: {{ include "common.fullname" . }}-config
109 configMap:
110 name: {{ include "common.fullname" . }}
ktimoneyb3aef7b2021-09-13 08:27:58 +0100111 - name: logs
112 emptyDir: {}
113 {{ if .Values.global.centralizedLoggingEnabled }}{{ include "common.log.volumes" . | nindent 8 }}{{ end }}
amatthews736bf372021-12-14 16:04:15 +0000114 - name: policy-gui-config
115 configMap:
116 name: {{ include "common.fullname" . }}-configmap
117 defaultMode: 0755
118 - name: policy-gui-config-processed
119 emptyDir:
120 medium: Memory
ktimoneyb3aef7b2021-09-13 08:27:58 +0100121 imagePullSecrets:
122 - name: "{{ include "common.namespace" . }}-docker-registry-key"