blob: 49406ba4230f64a55a6c39e5b42d62bf2dd63bcc [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" . }}-healthcheck
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:
Sylvain Desbureaux01c711e2020-11-21 21:47:01 +010036 - image: {{ include "repositoryGenerator.image.readiness" . }}
Dileep Ranganathan61225cb2018-10-01 08:14:16 -070037 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
38 name: {{ include "common.name" . }}-readiness
39 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020040 - /app/ready.py
Dileep Ranganathan61225cb2018-10-01 08:14:16 -070041 args:
42 - --container-name
43 - oof-has-api
44 env:
45 - name: NAMESPACE
46 valueFrom:
47 fieldRef:
48 apiVersion: v1
49 fieldPath: metadata.namespace
50 containers:
Sylvain Desbureaux01c711e2020-11-21 21:47:01 +010051 - image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.image.optf_has }}
dkamdocs6ad3a1c2018-12-21 09:25:53 +000052 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Dileep Ranganathan61225cb2018-10-01 08:14:16 -070053 name: {{ include "common.name" . }}-healthcheck
54 command:
55 - "/bin/sh"
56 - "-c"
57 - |
58 echo "INSERT HEALTHCHECK PLAN";
59 sleep 15;
60 resp="FAILURE";
61 until [ $resp = "200" ]; do
Tschaen, Brendan08d7b632020-04-02 19:49:13 +000062 resp=$(curl -k -s -o /dev/null --write-out %{http_code} -X POST https://{{.Values.config.music.serviceName}}.{{ include "common.namespace" . }}:{{.Values.config.music.port}}/MUSIC/rest/v2/keyspaces/conductor/tables/plans/rows?id=healthcheck \
Dileep Ranganathan61225cb2018-10-01 08:14:16 -070063 -H "Content-Type: application/json" \
64 -H "ns: conductor" \
65 -H "Authorization: Basic Y29uZHVjdG9yOmMwbmR1Y3Qwcg==" \
66 --data @healthcheck.json);
67 echo $resp;
68 sleep 2;
69 done;
70 workingDir: /has
71 volumeMounts:
72 - mountPath: /etc/localtime
73 name: localtime
74 readOnly: true
75 - mountPath: /has/healthcheck.json
76 name: {{ .Values.global.commonConfigPrefix }}-config
77 subPath: healthcheck.json
78 resources:
krishnaa96f122bbe2020-09-11 15:36:32 +053079{{ include "common.resources" . | indent 10 }}
Dileep Ranganathan61225cb2018-10-01 08:14:16 -070080 nodeSelector:
81 {{- if .Values.nodeSelector }}
82{{ toYaml .Values.nodeSelector | indent 8 }}
83 {{- end -}}
84 {{- if .Values.affinity }}
85 affinity:
86{{ toYaml .Values.affinity | indent 8 }}
87 {{- end }}
88 volumes:
89 - name: localtime
90 hostPath:
91 path: /etc/localtime
92 - name: {{ .Values.global.commonConfigPrefix }}-config
93 configMap:
94 name: {{ .Values.global.commonConfigPrefix }}-configmap
95 items:
96 - key: healthcheck.json
97 path: healthcheck.json
98 restartPolicy: OnFailure
99 imagePullSecrets:
dkamdocs6ad3a1c2018-12-21 09:25:53 +0000100 - name: "{{ include "common.namespace" . }}-docker-registry-key"