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