From d617f2cc4c95da7881eb062909823e5ed96571c3 Mon Sep 17 00:00:00 2001 From: Fran Mulero Date: Thu, 30 May 2024 10:18:30 +0200 Subject: [PATCH] [bitnami/template] Update PDB defintion in our scaffolding template (#26544) Signed-off-by: Fran Mulero --- template/CHART_NAME/templates/pdb.yaml | 8 ++++---- template/CHART_NAME/values.yaml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/template/CHART_NAME/templates/pdb.yaml b/template/CHART_NAME/templates/pdb.yaml index 84ca02fd8c..c6b4d460f1 100644 --- a/template/CHART_NAME/templates/pdb.yaml +++ b/template/CHART_NAME/templates/pdb.yaml @@ -3,7 +3,7 @@ Copyright Broadcom, Inc. All Rights Reserved. SPDX-License-Identifier: APACHE-2.0 */}} -{{- if and .Values.%%MAIN_OBJECT_BLOCK%%.pdb.create }} +{{- if .Values.%%MAIN_OBJECT_BLOCK%%.pdb.create }} apiVersion: {{ include "common.capabilities.policy.apiVersion" . }} kind: PodDisruptionBudget metadata: @@ -18,10 +18,10 @@ spec: {{- if .Values.%%MAIN_OBJECT_BLOCK%%.pdb.minAvailable }} minAvailable: {{ .Values.%%MAIN_OBJECT_BLOCK%%.pdb.minAvailable }} {{- end }} - {{- if .Values.%%MAIN_OBJECT_BLOCK%%.pdb.maxUnavailable }} - maxUnavailable: {{ .Values.%%MAIN_OBJECT_BLOCK%%.pdb.maxUnavailable }} + {{- if or .Values.%%MAIN_OBJECT_BLOCK%%.pdb.maxUnavailable ( not .Values.%%MAIN_OBJECT_BLOCK%%.pdb.minAvailable ) }} + maxUnavailable: {{ .Values.%%MAIN_OBJECT_BLOCK%%.pdb.maxUnavailable | default 1 }} {{- end }} - {{- $podLabels := include "common.tplvalues.merge" (dict "values" (list .Values.%%MAIN_OBJECT_BLOCK%%.podLabels .Values.commonLabels) "context" .) }} + {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.%%MAIN_OBJECT_BLOCK%%.podLabels .Values.commonLabels ) "context" . ) }} selector: matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: %%COMPONENT_NAME%% diff --git a/template/CHART_NAME/values.yaml b/template/CHART_NAME/values.yaml index 776f7e336e..de1cc06299 100644 --- a/template/CHART_NAME/values.yaml +++ b/template/CHART_NAME/values.yaml @@ -379,11 +379,11 @@ diagnosticMode: ## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb ## @param %%MAIN_OBJECT_BLOCK%%.pdb.create Enable/disable a Pod Disruption Budget creation ## @param %%MAIN_OBJECT_BLOCK%%.pdb.minAvailable Minimum number/percentage of pods that should remain scheduled - ## @param %%MAIN_OBJECT_BLOCK%%.pdb.maxUnavailable Maximum number/percentage of pods that may be made unavailable + ## @param %%MAIN_OBJECT_BLOCK%%.pdb.maxUnavailable Maximum number/percentage of pods that may be made unavailable. Defaults to `1` if both `%%MAIN_OBJECT_BLOCK%%.pdb.minAvailable` and `%%MAIN_OBJECT_BLOCK%%.pdb.maxUnavailable` are empty. ## pdb: - create: false - minAvailable: 1 + create: true + minAvailable: "" maxUnavailable: "" ## Autoscaling configuration ## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/