From 736c936394ce33d36665f806c89a30c56affe67e Mon Sep 17 00:00:00 2001 From: "Anselme, Schubert (sa246v)" Date: Wed, 23 Aug 2023 14:11:24 -0400 Subject: [PATCH] Parametrise readiness probe Change-Id: I358ae8307799fff0674a428c42b90381d6d3a631 Signed-off-by: Anselme, Schubert (sa246v) --- charts/maas/Chart.yaml | 2 +- charts/maas/templates/_job-readiness.tpl | 21 ++++++++++++++++ charts/maas/templates/job-export-api-key.yaml | 6 +---- charts/maas/templates/job-import.yaml | 6 +---- charts/maas/templates/statefulset-rack.yaml | 17 ++++++------- charts/maas/values.yaml | 25 +++++++++++++++++++ 6 files changed, 57 insertions(+), 20 deletions(-) create mode 100644 charts/maas/templates/_job-readiness.tpl diff --git a/charts/maas/Chart.yaml b/charts/maas/Chart.yaml index 675f682..35e2830 100755 --- a/charts/maas/Chart.yaml +++ b/charts/maas/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 description: Chart to run Canonical MaaS name: maas -version: 0.1.4 +version: 0.1.5 home: https://docs.ubuntu.com/maas sources: - https://git.launchpad.net/maas diff --git a/charts/maas/templates/_job-readiness.tpl b/charts/maas/templates/_job-readiness.tpl new file mode 100644 index 0000000..13fe5ec --- /dev/null +++ b/charts/maas/templates/_job-readiness.tpl @@ -0,0 +1,21 @@ +{{/* +Copyright 2023 The Openstack-Helm Authors. +Copyright (c) 2023 AT&T Intellectual Property. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} +{{- define "jobreadinessProbeTemplate" }} +exec: + command: + - /tmp/job-readiness.sh +{{- end }} diff --git a/charts/maas/templates/job-export-api-key.yaml b/charts/maas/templates/job-export-api-key.yaml index 0ac29ce..86e45f7 100644 --- a/charts/maas/templates/job-export-api-key.yaml +++ b/charts/maas/templates/job-export-api-key.yaml @@ -104,11 +104,7 @@ spec: value: {{ .Values.conf.maas.credentials.secret.name }} command: - /tmp/export-api-key.sh - readinessProbe: - exec: - command: - - /tmp/job-readiness.sh - initialDelaySeconds: 60 +{{ dict "envAll" $envAll "component" "export-api-key" "container" "exporter" "type" "readiness" "probeTemplate" (include "jobreadinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} volumeMounts: - name: maas-bin mountPath: /tmp/export-api-key.sh diff --git a/charts/maas/templates/job-import.yaml b/charts/maas/templates/job-import.yaml index 467a1c2..4ec7d75 100644 --- a/charts/maas/templates/job-import.yaml +++ b/charts/maas/templates/job-import.yaml @@ -98,11 +98,7 @@ spec: {{ dict "envAll" $envAll "application" "import_resources" "container" "region_import_resources" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: - /tmp/import-boot-resources.sh - readinessProbe: - exec: - command: - - /tmp/job-readiness.sh - initialDelaySeconds: 60 +{{ dict "envAll" $envAll "component" "import-resources" "container" "region-import-resources" "type" "readiness" "probeTemplate" (include "jobreadinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} volumeMounts: - name: maas-bin mountPath: /tmp/import-boot-resources.sh diff --git a/charts/maas/templates/statefulset-rack.yaml b/charts/maas/templates/statefulset-rack.yaml index f8ce48f..49eca4e 100644 --- a/charts/maas/templates/statefulset-rack.yaml +++ b/charts/maas/templates/statefulset-rack.yaml @@ -15,8 +15,14 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- if .Values.manifests.rack_statefulset }} {{- $envAll := . }} +{{- define "maasrackreadinessProbeTemplate" }} +exec: + command: + - ls + - /tmp/maas-rack.done +{{- end }} +{{- if .Values.manifests.rack_statefulset }} {{- $serviceAccountName := "maas-rack" }} {{- $mounts_maas_rack := .Values.pod.mounts.maas_rack }} {{- $mounts_maas_rack_init := .Values.pod.mounts.maas_rack.init_container }} @@ -86,14 +92,7 @@ spec: {{ tuple $envAll $envAll.Values.pod.resources.maas_rack | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} command: - /tmp/start.sh - readinessProbe: - initialDelaySeconds: 60 - periodSeconds: 60 - timeoutSeconds: 60 - exec: - command: - - ls - - /tmp/maas-rack.done +{{ dict "envAll" $envAll "component" "rack" "container" "maas-rack" "type" "readiness" "probeTemplate" (include "maasrackreadinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} volumeMounts: - mountPath: /sys/fs/cgroup name: host-sys-fs-cgroup diff --git a/charts/maas/values.yaml b/charts/maas/values.yaml index 7daec84..f391d1c 100644 --- a/charts/maas/values.yaml +++ b/charts/maas/values.yaml @@ -592,6 +592,31 @@ pod: limits: memory: "1024Mi" cpu: "2000m" + probes: + rack: + maas-rack: + readiness: + enabled: true + params: + initialDelaySeconds: 60 + periodSeconds: 60 + timeoutSeconds: 60 + export-api-key: + exporter: + readiness: + enabled: true + params: + initialDelaySeconds: 60 + periodSeconds: 60 + timeoutSeconds: 60 + import-resources: + region-import-resources: + readiness: + enabled: true + params: + initialDelaySeconds: 60 + periodSeconds: 60 + timeoutSeconds: 60 endpoints: cluster_domain_suffix: cluster.local