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