Dileep Ranganathan | 61225cb | 2018-10-01 08:14:16 -0700 | [diff] [blame] | 1 | {{/* |
| 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 | |
| 17 | apiVersion: batch/v1 |
| 18 | kind: Job |
| 19 | metadata: |
| 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 Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 25 | release: {{ include "common.release" . }} |
Dileep Ranganathan | 61225cb | 2018-10-01 08:14:16 -0700 | [diff] [blame] | 26 | heritage: {{ .Release.Service }} |
| 27 | spec: |
| 28 | replicas: {{ .Values.replicaCount }} |
| 29 | template: |
| 30 | metadata: |
| 31 | labels: |
| 32 | app: {{ include "common.name" . }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 33 | release: {{ include "common.release" . }} |
Dileep Ranganathan | 61225cb | 2018-10-01 08:14:16 -0700 | [diff] [blame] | 34 | spec: |
| 35 | initContainers: |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 36 | - image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}" |
Dileep Ranganathan | 61225cb | 2018-10-01 08:14:16 -0700 | [diff] [blame] | 37 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 38 | name: {{ include "common.name" . }}-readiness |
| 39 | command: |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 40 | - /app/ready.py |
Dileep Ranganathan | 61225cb | 2018-10-01 08:14:16 -0700 | [diff] [blame] | 41 | 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: |
| 51 | - image: "{{ include "common.repository" . }}/{{ .Values.global.image.optf_has }}" |
dkamdocs | 6ad3a1c | 2018-12-21 09:25:53 +0000 | [diff] [blame] | 52 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Dileep Ranganathan | 61225cb | 2018-10-01 08:14:16 -0700 | [diff] [blame] | 53 | 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, Brendan | 08d7b63 | 2020-04-02 19:49:13 +0000 | [diff] [blame] | 62 | 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 Ranganathan | 61225cb | 2018-10-01 08:14:16 -0700 | [diff] [blame] | 63 | -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: |
krishnaa96 | f122bbe | 2020-09-11 15:36:32 +0530 | [diff] [blame^] | 79 | {{ include "common.resources" . | indent 10 }} |
Dileep Ranganathan | 61225cb | 2018-10-01 08:14:16 -0700 | [diff] [blame] | 80 | 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: |
dkamdocs | 6ad3a1c | 2018-12-21 09:25:53 +0000 | [diff] [blame] | 100 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |