blob: 6b5a7bfef34f7d6afacf23f00119e609504d317b [file] [log] [blame]
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -04001# Copyright © 2017 Amdocs, Bell Canada, AT&T
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15apiVersion: batch/v1
16kind: Job
17metadata:
18 name: {{ include "common.fullname" . }}-dbinit-job
19 namespace: {{ include "common.namespace" . }}
20 labels:
21 app: {{ include "common.name" . }}
22 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23 release: {{ .Release.Name }}
24 heritage: {{ .Release.Service }}
25 annotations:
26 "helm.sh/hook": post-install
27 "helm.sh/hook-weight": "0"
28 "helm.sh/hook-delete-policy": before-hook-creation
29spec:
30 backoffLimit: 20
31 template:
32 metadata:
33 labels:
34 app: {{ include "common.name" . }}-job
35 release: {{ .Release.Name }}
36 name: {{ include "common.name" . }}
37 spec:
38 initContainers:
39 - name: {{ include "common.name" . }}-readiness
40 command:
41 - /root/ready.py
42 args:
43 - --container-name
44 - {{ .Values.config.mariadbGalera.chartName }}
45 env:
46 - name: NAMESPACE
47 valueFrom:
48 fieldRef:
49 apiVersion: v1
50 fieldPath: metadata.namespace
51 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
52 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53 containers:
54 - name: {{ include "common.name" . }}
Timoney, Dan (dt5972)103b69b2019-08-08 13:21:16 -040055 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040056 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
57 env:
58 - name: MYSQL_PASSWORD
59 valueFrom:
60 secretKeyRef:
61 name: {{ template "common.fullname" . }}
62 key: db-root-password
63 - name: ODL_ADMIN_PASSWORD
64 valueFrom:
65 secretKeyRef:
66 name: {{ template "common.fullname" . }}-odl
67 key: odl-password
68 - name: SDNC_DB_PASSWORD
69 valueFrom:
70 secretKeyRef:
71 name: {{ template "common.fullname" . }}-sdnctl
72 key: db-sdnctl-password
73 - name: MYSQL_HOST
74 value: "{{.Values.config.mariadbGalera.serviceName}}.{{.Release.Namespace}}"
75 - name: SDNC_HOME
76 value: "{{.Values.config.sdncHome}}"
77 - name: ETC_DIR
78 value: "{{.Values.config.etcDir}}"
79 - name: BIN_DIR
80 value: "{{.Values.config.binDir}}"
81 - name: SDNC_DB_USER
82 value: "{{.Values.config.dbSdnctlUser}}"
83 - name: SDNC_DB_DATABASE
84 value: "{{.Values.config.dbSdnctlDatabase}}"
85 volumeMounts:
86 - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
87 name: bin
88 subPath: installSdncDb.sh
89 - mountPath: {{ .Values.config.configDir }}/svclogic.properties
90 name: properties
91 subPath: svclogic.properties
92 - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
93 name: properties
94 subPath: svclogic.properties
95 - mountPath: {{ .Values.config.configDir }}/dblib.properties
96 name: properties
97 subPath: dblib.properties
98 command:
99 - /bin/bash
100 args:
101 - {{.Values.config.binDir }}/installSdncDb.sh
102 resources:
103{{ include "common.resources" . | indent 12 }}
104 {{- if .Values.nodeSelector }}
105 nodeSelector:
106{{ toYaml .Values.nodeSelector | indent 10 }}
107 {{- end -}}
108 {{- if .Values.affinity }}
109 affinity:
110{{ toYaml .Values.affinity | indent 10 }}
111 {{- end }}
112 volumes:
113 - name: localtime
114 hostPath:
115 path: /etc/localtime
116 - name: docker-entrypoint-initdb-d
117 emptyDir: {}
118 - name: bin
119 configMap:
120 name: {{ include "common.fullname" . }}-bin
121 defaultMode: 0755
122 - name: properties
123 configMap:
124 name: {{ include "common.fullname" . }}-properties
125 defaultMode: 0644
126 restartPolicy: Never
127 imagePullSecrets:
128 - name: "{{ include "common.namespace" . }}-docker-registry-key"
129