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