2 # Copyright © 2020 Orange
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 Generate readiness part for a pod
19 Will look by default to .Values.wait_for
21 Value of wait_for is an array of all pods /jobs to wait:
30 The function can takes two arguments (inside a dictionary):
31 - .dot : environment (.)
32 - .wait_for : list of containers / jobs to wait for (default to
36 {{ include "common.readinessCheck.waitFor" . }}
37 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.where.my.wait_for.is ) }}
39 {{- define "common.readinessCheck.waitFor" -}}
40 {{- $dot := default . .dot -}}
41 {{- $initRoot := default $dot.Values.readinessCheck .initRoot -}}
42 {{/* Our version of helm doesn't support deepCopy so we need this nasty trick */}}
43 {{- $subchartDot := fromJson (include "common.subChartDot" (dict "dot" $dot "initRoot" $initRoot)) }}
44 {{- $wait_for := default $initRoot.wait_for .wait_for -}}
45 - name: {{ include "common.name" $dot }}-{{ $wait_for.name }}-readiness
46 image: "{{ $subchartDot.Values.global.readinessRepository }}/{{ $subchartDot.Values.global.readinessImage }}"
47 imagePullPolicy: {{ $subchartDot.Values.global.pullPolicy | default $subchartDot.Values.pullPolicy }}
51 {{- range $container := $wait_for.containers }}
53 - {{ tpl $container $dot }}
60 fieldPath: metadata.namespace
63 cpu: {{ $subchartDot.Values.limits.cpu }}
64 memory: {{ $subchartDot.Values.limits.memory }}
66 cpu: {{ $subchartDot.Values.requests.cpu }}
67 memory: {{ $subchartDot.Values.requests.memory }}