Merge "[COMMON][READINESS] Update readiness image and use service feature"
[oom.git] / kubernetes / common / readinessCheck / templates / _readinessCheck.tpl
index 879be12..51791fe 100644 (file)
     pods:
       - test-pod
 
+  the powerful one allows also to wait for a service to be
+  available, which means all pods are deployed, which are
+  selected by the service definition:
+  wait_for:
+    name: myservice
+    services:
+      - mariadb-galera-service
+
   the powerful one allows also to wait for pods with the
   given "app" label:
   wait_for:
@@ -62,8 +70,8 @@
      - .dot : environment (.)
      - .initRoot : the root dictionary of readinessCheck submodule
                    (default to .Values.readinessCheck)
-     - .wait_for : list of containers / pods /apps / jobs to wait for (default to
-                   .Values.wait_for)
+     - .wait_for : list of service / containers / pods /apps / jobs to wait for
+                   (default to .Values.wait_for)
 
   Example calls:
     {{ include "common.readinessCheck.waitFor" . }}
@@ -76,6 +84,7 @@
 {{-   $subchartDot := fromJson (include "common.subChartDot" (dict "dot" $dot "initRoot" $initRoot)) }}
 {{-   $wait_for := default $initRoot.wait_for .wait_for -}}
 {{-   $containers := index (ternary (dict "containers" $wait_for) $wait_for (kindIs "slice" $wait_for)) "containers" -}}
+{{-   $services := index (ternary (dict) $wait_for (kindIs "slice" $wait_for)) "services" -}}
 {{-   $pods := index (ternary (dict) $wait_for (kindIs "slice" $wait_for)) "pods" -}}
 {{-   $apps := index (ternary (dict) $wait_for (kindIs "slice" $wait_for)) "apps" -}}
 {{-   $namePart := index (ternary (dict) $wait_for (kindIs "slice" $wait_for)) "name" -}}
   - --pod-name
   - {{ tpl $pod $dot }}
   {{- end }}
+  {{- range $service := default (list) $services }}
+  - --service-name
+  - {{ tpl $service $dot }}
+  {{- end }}
   {{- range $app := default (list) $apps }}
   - --app-name
   - {{ tpl $app $dot }}