blob: c9b6800ffdfbda0ca3ce3990e71cb6ad4135874d [file] [log] [blame]
Jakub Latusek67f4e8d2020-10-21 13:36:29 +02001{{/*
Durgpal7ad40692018-08-03 07:28:36 +00002# Modifications Copyright © 2018 Amdocs,Bell Canada
Dominic Lunanuovae825fee2018-04-12 14:40:34 +00003#
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.
Jakub Latusek67f4e8d2020-10-21 13:36:29 +020015*/}}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000016
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010017apiVersion: apps/v1
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000018kind: Deployment
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010019metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000020spec:
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010021 selector: {{- include "common.selectors" . | nindent 4 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000022 replicas: {{ .Values.replicaCount }}
23 template:
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010024 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000025 spec:
rope252f2db5c12022-01-10 14:15:16 +000026 {{ include "common.podSecurityContext" . | indent 6 | trim}}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010027{{- if or .Values.global.aafEnabled .Values.PG.enabled }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000028 initContainers:
Krzysztof Opasiak03a125a2020-05-05 02:11:09 +020029 - command:
30 - sh
31 args:
32 - -c
33 - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
34 env:
35 - name: PG_USER
36 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
37 - name: PG_PASSWORD
38 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
39 volumeMounts:
40 - mountPath: /config-input
41 name: {{ include "common.name" . }}-config-input
42 - mountPath: /config
43 name: {{ include "common.name" . }}-config
Sylvain Desbureaux6b096542020-11-21 22:51:24 +010044 image: {{ include "repositoryGenerator.image.envsubst" . }}
Krzysztof Opasiak03a125a2020-05-05 02:11:09 +020045 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
46 name: {{ include "common.name" . }}-update-config
Krzysztof Opasiakc32ee222020-05-07 00:26:00 +020047{{ include "common.certInitializer.initContainer" . | nindent 6 }}
Dominic Lunanuovade7a02b2020-03-12 16:36:09 +000048 - name: {{ include "common.name" . }}-permission-fixer
rope252f2db5c12022-01-10 14:15:16 +000049 securityContext:
50 runAsUser: 0
Sylvain Desbureaux6b096542020-11-21 22:51:24 +010051 image: {{ include "repositoryGenerator.image.busybox" . }}
Dominic Lunanuovade7a02b2020-03-12 16:36:09 +000052 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Krzysztof Opasiakc32ee222020-05-07 00:26:00 +020053 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
Dominic Lunanuovade7a02b2020-03-12 16:36:09 +000054 command: ["chown","-Rf","1000:1001", "/opt/app/"]
55# See AAF-425 for explanation of why this is needed.
56# This artifact is provisioned in AAF for both pks12 and jks format and apparently
57# the cadi library is not using the jks password on the jks keystore.
58# So, this attempts to "fix" the credential property file until this is fixed properly.
59 - name: {{ include "common.name" . }}-cred-fixer
Sylvain Desbureaux6b096542020-11-21 22:51:24 +010060 image: {{ include "repositoryGenerator.image.busybox" . }}
Dominic Lunanuovade7a02b2020-03-12 16:36:09 +000061 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Krzysztof Opasiakc32ee222020-05-07 00:26:00 +020062 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
Dominic Lunanuovade7a02b2020-03-12 16:36:09 +000063 command: ["/bin/sh"]
64 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" ]
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010065 - name: {{ include "common.name" . }}-postgres-readiness
rope252f2db5c12022-01-10 14:15:16 +000066 securityContext:
67 runAsUser: 100
68 runAsGroup: 65533
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010069 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020070 - /app/ready.py
dglFromAttfb58a9d2019-04-12 20:12:26 +000071 args:
72 - --container-name
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000073 - {{ .Values.postgres.nameOverride }}
efiacorc75eacb2020-04-24 14:29:17 +010074 - --container-name
75 - message-router
76 - --container-name
77 - dmaap-dr-node
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000078 env:
79 - name: NAMESPACE
80 valueFrom:
81 fieldRef:
82 apiVersion: v1
83 fieldPath: metadata.namespace
Sylvain Desbureaux6b096542020-11-21 22:51:24 +010084 image: {{ include "repositoryGenerator.image.readiness" . }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000085 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010086{{- end }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000087 containers:
88 - name: {{ include "common.name" . }}
Sylvain Desbureaux6b096542020-11-21 22:51:24 +010089 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000090 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010091 ports: {{ include "common.containerPorts" . | nindent 10 }}
efiacore62958b2019-09-27 16:54:36 +010092 {{ if eq .Values.liveness.enabled true -}}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000093 livenessProbe:
94 httpGet:
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +010095 port: {{ .Values.liveness.port }}
96 path: /webapi/topics
97 scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000098 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
dglFromAttec0918d2018-10-17 19:34:49 +000099 periodSeconds: {{ .Values.liveness.periodSeconds }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100100 {{ end -}}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000101 readinessProbe:
102 httpGet:
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100103 port: {{ .Values.readiness.port }}
104 path: /webapi/topics
105 scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000106 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
107 periodSeconds: {{ .Values.readiness.periodSeconds }}
Krzysztof Opasiakc32ee222020-05-07 00:26:00 +0200108 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000109 - mountPath: /etc/localtime
110 name: localtime
111 readOnly: true
dglFromAttec0918d2018-10-17 19:34:49 +0000112# NOTE: on the following several configMaps, careful to include / at end
113# since there may be more than one file in each mountPath
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000114 - name: {{ include "common.name" . }}-config
dglFromAtt82340072018-10-16 21:53:34 +0000115 mountPath: /opt/app/config/conf/
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100116 resources: {{ include "common.resources" . | nindent 12 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000117 {{- if .Values.nodeSelector }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100118 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000119 {{- end -}}
120 {{- if .Values.affinity }}
Sylvain Desbureaux0de113e2020-03-10 09:57:25 +0100121 affinity: {{ toYaml .Values.affinity | nindent 10 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000122 {{- end }}
farida azmy13388ba2021-03-17 11:33:28 +0200123 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Krzysztof Opasiakc32ee222020-05-07 00:26:00 +0200124 volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000125 - name: localtime
126 hostPath:
127 path: /etc/localtime
Krzysztof Opasiak03a125a2020-05-05 02:11:09 +0200128 - name: {{ include "common.name" . }}-config-input
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000129 configMap:
130 name: {{ include "common.fullname" . }}-config
Krzysztof Opasiak03a125a2020-05-05 02:11:09 +0200131 - name: {{ include "common.name" . }}-config
132 emptyDir:
133 medium: Memory
Dominic Lunanuovae825fee2018-04-12 14:40:34 +0000134 imagePullSecrets:
135 - name: "{{ include "common.namespace" . }}-docker-registry-key"