Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 1 | {{/* |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 2 | # Copyright © 2017 Amdocs, Bell Canada, AT&T |
| 3 | # |
| 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. |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 15 | */}} |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 16 | |
| 17 | apiVersion: batch/v1 |
| 18 | kind: Job |
| 19 | metadata: |
| 20 | name: {{ include "common.fullname" . }}-dbinit-job |
| 21 | namespace: {{ include "common.namespace" . }} |
| 22 | labels: |
| 23 | app: {{ include "common.name" . }} |
| 24 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 25 | release: {{ include "common.release" . }} |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 26 | heritage: {{ .Release.Service }} |
| 27 | annotations: |
| 28 | "helm.sh/hook": post-install |
| 29 | "helm.sh/hook-weight": "0" |
| 30 | "helm.sh/hook-delete-policy": before-hook-creation |
| 31 | spec: |
| 32 | backoffLimit: 20 |
| 33 | template: |
| 34 | metadata: |
| 35 | labels: |
| 36 | app: {{ include "common.name" . }}-job |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 37 | release: {{ include "common.release" . }} |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 38 | name: {{ include "common.name" . }} |
| 39 | spec: |
| 40 | initContainers: |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 41 | - command: |
| 42 | - sh |
| 43 | args: |
| 44 | - -c |
| 45 | - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done" |
| 46 | env: |
| 47 | - name: AAI_CLIENT_NAME |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 48 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "login") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 49 | - name: AAI_CLIENT_PASSWORD |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 50 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "password") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 51 | - name: MODELSERVICE_USER |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 52 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "login") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 53 | - name: MODELSERVICE_PASSWORD |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 54 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "password") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 55 | - name: RESTCONF_USER |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 56 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 57 | - name: RESTCONF_PASSWORD |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 58 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 59 | - name: ANSIBLE_USER |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 60 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "login") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 61 | - name: ANSIBLE_PASSWORD |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 62 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "password") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 63 | - name: SCALEOUT_USER |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 64 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "login") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 65 | - name: SCALEOUT_PASSWORD |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 66 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "password") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 67 | - name: NETBOX_APIKEY |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 68 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "netbox-apikey" "key" "password") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 69 | - name: SDNC_DB_USER |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 70 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 71 | - name: SDNC_DB_PASSWORD |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 72 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 73 | volumeMounts: |
| 74 | - mountPath: /config-input |
| 75 | name: config-input |
| 76 | - mountPath: /config |
| 77 | name: properties |
| 78 | image: "{{ .Values.global.envsubstImage }}" |
| 79 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 80 | name: {{ include "common.name" . }}-update-config |
| 81 | |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 82 | - name: {{ include "common.name" . }}-readiness |
| 83 | command: |
| 84 | - /root/ready.py |
| 85 | args: |
| 86 | - --container-name |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 87 | - {{ include "common.mariadbService" . }} |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 88 | env: |
| 89 | - name: NAMESPACE |
| 90 | valueFrom: |
| 91 | fieldRef: |
| 92 | apiVersion: v1 |
| 93 | fieldPath: metadata.namespace |
| 94 | image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" |
| 95 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 96 | containers: |
| 97 | - name: {{ include "common.name" . }} |
Timoney, Dan (dt5972) | 103b69b | 2019-08-08 13:21:16 -0400 | [diff] [blame] | 98 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 99 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 100 | env: |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 101 | - name: MYSQL_ROOT_PASSWORD |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 102 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 103 | - name: ODL_ADMIN_USERNAME |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 104 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 12 }} |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 105 | - name: ODL_ADMIN_PASSWORD |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 106 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 12 }} |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 107 | - name: SDNC_DB_USER |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 108 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }} |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 109 | - name: SDNC_DB_PASSWORD |
Krzysztof Opasiak | ab7a6bb | 2020-03-24 03:30:51 +0100 | [diff] [blame] | 110 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }} |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 111 | - name: MYSQL_HOST |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 112 | value: {{ include "common.mariadbService" . }} |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 113 | - name: SDNC_HOME |
| 114 | value: "{{.Values.config.sdncHome}}" |
| 115 | - name: ETC_DIR |
| 116 | value: "{{.Values.config.etcDir}}" |
| 117 | - name: BIN_DIR |
| 118 | value: "{{.Values.config.binDir}}" |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 119 | - name: SDNC_DB_DATABASE |
| 120 | value: "{{.Values.config.dbSdnctlDatabase}}" |
| 121 | volumeMounts: |
| 122 | - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh |
| 123 | name: bin |
| 124 | subPath: installSdncDb.sh |
| 125 | - mountPath: {{ .Values.config.configDir }}/svclogic.properties |
| 126 | name: properties |
| 127 | subPath: svclogic.properties |
| 128 | - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties |
| 129 | name: properties |
| 130 | subPath: svclogic.properties |
| 131 | - mountPath: {{ .Values.config.configDir }}/dblib.properties |
| 132 | name: properties |
| 133 | subPath: dblib.properties |
| 134 | command: |
| 135 | - /bin/bash |
| 136 | args: |
| 137 | - {{.Values.config.binDir }}/installSdncDb.sh |
| 138 | resources: |
| 139 | {{ include "common.resources" . | indent 12 }} |
| 140 | {{- if .Values.nodeSelector }} |
| 141 | nodeSelector: |
| 142 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 143 | {{- end -}} |
| 144 | {{- if .Values.affinity }} |
| 145 | affinity: |
| 146 | {{ toYaml .Values.affinity | indent 10 }} |
| 147 | {{- end }} |
| 148 | volumes: |
| 149 | - name: localtime |
| 150 | hostPath: |
| 151 | path: /etc/localtime |
| 152 | - name: docker-entrypoint-initdb-d |
| 153 | emptyDir: {} |
| 154 | - name: bin |
| 155 | configMap: |
| 156 | name: {{ include "common.fullname" . }}-bin |
| 157 | defaultMode: 0755 |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 158 | - name: config-input |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 159 | configMap: |
| 160 | name: {{ include "common.fullname" . }}-properties |
| 161 | defaultMode: 0644 |
Krzysztof Opasiak | cc97c73 | 2020-02-25 23:31:20 +0100 | [diff] [blame] | 162 | - name: properties |
| 163 | emptyDir: |
| 164 | medium: Memory |
Timoney, Dan (dt5972) | a3bc1a5 | 2019-06-26 16:16:52 -0400 | [diff] [blame] | 165 | restartPolicy: Never |
| 166 | imagePullSecrets: |
| 167 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |