Jakub Latusek | 44f0fdd | 2020-10-21 13:36:29 +0200 | [diff] [blame] | 1 | {{/* |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 2 | # ============LICENSE_START======================================================= |
| 3 | # Copyright (C) 2018 Ericsson. All rights reserved. |
Krzysztof Gajewski | cd2e66f | 2020-10-15 20:33:34 +0200 | [diff] [blame] | 4 | # Modifications Copyright © 2020 Nokia |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 5 | # ================================================================================ |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | # SPDX-License-Identifier: Apache-2.0 |
| 19 | # ============LICENSE_END========================================================= |
| 20 | # @author: gareth.roper@ericsson.com |
Jakub Latusek | 44f0fdd | 2020-10-21 13:36:29 +0200 | [diff] [blame] | 21 | */}} |
Grzegorz-Lis | d1c1f6a | 2020-07-29 12:22:40 +0200 | [diff] [blame] | 22 | apiVersion: apps/v1 |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 23 | kind: Deployment |
| 24 | metadata: |
| 25 | name: {{ include "common.fullname" . }} |
| 26 | namespace: {{ include "common.namespace" . }} |
| 27 | labels: |
| 28 | app: {{ include "common.fullname" . }} |
| 29 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 30 | release: {{ include "common.release" . }} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 31 | spec: |
Grzegorz-Lis | d1c1f6a | 2020-07-29 12:22:40 +0200 | [diff] [blame] | 32 | selector: |
| 33 | matchLabels: |
| 34 | app: {{ include "common.name" . }} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 35 | replicas: {{ index .Values.replicaCount }} |
| 36 | minReadySeconds: {{ index .Values.minReadySeconds }} |
| 37 | strategy: |
| 38 | type: {{ index .Values.updateStrategy.type }} |
| 39 | rollingUpdate: |
| 40 | maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }} |
| 41 | maxSurge: {{ index .Values.updateStrategy.maxSurge }} |
| 42 | template: |
| 43 | metadata: |
| 44 | labels: |
| 45 | app: {{ include "common.name" . }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 46 | release: {{ include "common.release" . }} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 47 | spec: |
Krzysztof Gajewski | cd2e66f | 2020-10-15 20:33:34 +0200 | [diff] [blame] | 48 | initContainers: {{ include "so.certificate.container_importer" . | nindent 6 }} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 49 | - name: so-chown |
| 50 | image: alpine:3.6 |
| 51 | volumeMounts: |
| 52 | - name: logs |
| 53 | mountPath: /app/logs |
jmac | c4f04d3 | 2018-10-12 18:24:24 +0000 | [diff] [blame] | 54 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 55 | command: ["/bin/sh", "-c", "chown -Rf 1000:1000 /app/logs"] |
| 56 | restartPolicy: Always |
| 57 | containers: |
| 58 | - name: {{ include "common.name" . }} |
| 59 | image: {{ include "common.repository" . }}/{{ .Values.image }} |
seshukm | 0df1f8e | 2020-08-17 21:45:49 +0530 | [diff] [blame] | 60 | resources: {{ include "common.resources" . | nindent 12 }} |
Krzysztof Gajewski | cd2e66f | 2020-10-15 20:33:34 +0200 | [diff] [blame] | 61 | command: |
| 62 | - /bin/sh |
| 63 | args: |
| 64 | - -c |
| 65 | - | |
| 66 | export SO_MONITORING_PASSWORD=`htpasswd -bnBC 10 "" $SO_MON_PASS | tr -d ':\n' | sed 's/\$2y/\$2a/'` |
| 67 | {{- if .Values.global.aafEnabled }} |
| 68 | export $(grep '^c' {{ .Values.soHelpers.certInitializer.credsPath }}/org.onap.so.cred.props | xargs -0) |
| 69 | export $(grep '^c' {{ .Values.soHelpers.certInitializer.credsPath }}/mycreds.prop | xargs -0) |
| 70 | export KEYSTORE=file://$cadi_keystore |
| 71 | export KEYSTORE_PASSWORD=$cadi_keystore_password_p12 |
| 72 | export TRUSTSTORE=file://$cadi_truststore |
| 73 | export TRUSTSTORE_PASSWORD=$cadi_truststore_password |
| 74 | {{- end }} |
| 75 | /app/start-app.sh |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 76 | env: |
| 77 | - name: DB_HOST |
| 78 | valueFrom: |
| 79 | secretKeyRef: |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 80 | name: {{ include "common.release" . }}-so-db-secrets |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 81 | key: mariadb.readwrite.host |
| 82 | - name: DB_PORT |
| 83 | valueFrom: |
| 84 | secretKeyRef: |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 85 | name: {{ include "common.release" . }}-so-db-secrets |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 86 | key: mariadb.readwrite.port |
| 87 | - name: DB_USERNAME |
Krzysztof Opasiak | 0be83cb | 2020-03-24 21:44:00 +0100 | [diff] [blame] | 88 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 89 | - name: DB_PASSWORD |
Krzysztof Opasiak | 0be83cb | 2020-03-24 21:44:00 +0100 | [diff] [blame] | 90 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 91 | - name: DB_ADMIN_USERNAME |
Krzysztof Opasiak | 0be83cb | 2020-03-24 21:44:00 +0100 | [diff] [blame] | 92 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 93 | - name: DB_ADMIN_PASSWORD |
Krzysztof Opasiak | 0be83cb | 2020-03-24 21:44:00 +0100 | [diff] [blame] | 94 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }} |
Krzysztof Gajewski | cd2e66f | 2020-10-15 20:33:34 +0200 | [diff] [blame] | 95 | - name: SO_MONITORING_USERNAME |
| 96 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 10 }} |
| 97 | - name: SO_MON_PASS |
| 98 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 10 }} |
| 99 | |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 100 | envFrom: |
| 101 | - configMapRef: |
| 102 | name: {{ include "common.fullname" . }}-configmap |
jmac | c4f04d3 | 2018-10-12 18:24:24 +0000 | [diff] [blame] | 103 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Krzysztof Gajewski | cd2e66f | 2020-10-15 20:33:34 +0200 | [diff] [blame] | 104 | volumeMounts: {{ include "so.certificate.volumeMount" . | nindent 8 }} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 105 | - name: logs |
| 106 | mountPath: /app/logs |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 107 | - name: config |
| 108 | mountPath: /app/config |
| 109 | readOnly: true |
| 110 | readinessProbe: |
| 111 | tcpSocket: |
| 112 | port: {{ index .Values.readinessProbe.port }} |
| 113 | initialDelaySeconds: {{ index .Values.readinessProbe.initialDelaySeconds}} |
| 114 | periodSeconds: {{ index .Values.readinessProbe.periodSeconds}} |
| 115 | livenessProbe: |
| 116 | tcpSocket: |
| 117 | port: {{ index .Values.livenessProbe.port }} |
| 118 | initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}} |
| 119 | periodSeconds: {{ index .Values.livenessProbe.periodSeconds}} |
| 120 | successThreshold: {{ index .Values.livenessProbe.successThreshold}} |
| 121 | failureThreshold: {{ index .Values.livenessProbe.failureThreshold}} |
| 122 | |
| 123 | ports: |
| 124 | - containerPort: {{ index .Values.containerPort }} |
| 125 | name: {{ .Values.service.portName }} |
| 126 | protocol: TCP |
Krzysztof Gajewski | cd2e66f | 2020-10-15 20:33:34 +0200 | [diff] [blame] | 127 | volumes: {{ include "so.certificate.volumes" . | nindent 6 }} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 128 | - name: logs |
| 129 | emptyDir: {} |
rope252 | cd2142c | 2018-09-17 12:35:36 +0100 | [diff] [blame] | 130 | - name: config |
| 131 | configMap: |
| 132 | name: {{ include "common.fullname" . }}-app-configmap |
| 133 | imagePullSecrets: |
| 134 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |