blob: 499d0923c89bd3cb7949b03fff49708ddc7ebe7e [file] [log] [blame]
Dileep Ranganathan61225cb2018-10-01 08:14:16 -07001{{/*
2# Copyright 2018 Intel Corporation, Inc
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.
15*/}}
16
17apiVersion: batch/v1
18kind: Job
19metadata:
20 name: {{ include "common.fullname" . }}-onboard
21 namespace: {{ include "common.namespace" . }}
22 labels:
23 app: {{ include "common.name" . }}
24 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010025 release: {{ include "common.release" . }}
Dileep Ranganathan61225cb2018-10-01 08:14:16 -070026 heritage: {{ .Release.Service }}
27spec:
28 replicas: {{ .Values.replicaCount }}
29 template:
30 metadata:
31 labels:
32 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010033 release: {{ include "common.release" . }}
Dileep Ranganathan61225cb2018-10-01 08:14:16 -070034 spec:
35 initContainers:
36 - image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
37 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
38 name: {{ include "common.name" . }}-readiness
39 command:
40 - /root/ready.py
41 args:
42 - --container-name
43 - "music-tomcat"
44 - --container-name
45 - "music-cassandra"
46 env:
47 - name: NAMESPACE
48 valueFrom:
49 fieldRef:
50 apiVersion: v1
51 fieldPath: metadata.namespace
52 - command:
53 - /root/job_complete.py
54 args:
55 - -j
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010056 - "{{ include "common.release" . }}-music-cassandra-job-config"
Dileep Ranganathan61225cb2018-10-01 08:14:16 -070057 env:
58 - name: NAMESPACE
59 valueFrom:
60 fieldRef:
61 apiVersion: v1
62 fieldPath: metadata.namespace
63 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
64 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65 name: {{ include "common.name" . }}-music-db-readiness
66 containers:
67 - image: "{{ include "common.repository" . }}/{{ .Values.global.image.optf_has }}"
dkamdocs6ad3a1c2018-12-21 09:25:53 +000068 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Dileep Ranganathan61225cb2018-10-01 08:14:16 -070069 name: {{ include "common.name" . }}-onboard
70 command:
71 - "/bin/sh"
72 - "-c"
73 - |
74 curl -X POST http://{{.Values.config.music.serviceName}}.{{ include "common.namespace" . }}:{{.Values.config.music.port}}/MUSIC/rest/v2/admin/onboardAppWithMusic \
75 -H "Content-Type: application/json" \
76 -H "Authorization: Basic Y29uZHVjdG9yOmMwbmR1Y3Qwcg==" \
77 --data @onboard.json
78 workingDir: /has
79 volumeMounts:
80 - mountPath: /etc/localtime
81 name: localtime
82 readOnly: true
83 - mountPath: /has/onboard.json
84 name: {{ .Values.global.commonConfigPrefix }}-config
85 subPath: onboard.json
86 resources:
87{{ toYaml .Values.resources | indent 10 }}
88 nodeSelector:
89 {{- if .Values.nodeSelector }}
90{{ toYaml .Values.nodeSelector | indent 8 }}
91 {{- end -}}
92 {{- if .Values.affinity }}
93 affinity:
94{{ toYaml .Values.affinity | indent 8 }}
95 {{- end }}
96 volumes:
97 - name: localtime
98 hostPath:
99 path: /etc/localtime
100 - name: {{ .Values.global.commonConfigPrefix }}-config
101 configMap:
102 name: {{ .Values.global.commonConfigPrefix }}-configmap
103 items:
104 - key: onboard.json
105 path: onboard.json
106 restartPolicy: OnFailure
107 imagePullSecrets:
dkamdocs6ad3a1c2018-12-21 09:25:53 +0000108 - name: "{{ include "common.namespace" . }}-docker-registry-key"