Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: maxUnavailable pdb configuration cannot be used due to default set minAvailable #6087

Merged
merged 7 commits into from Jul 25, 2023
Expand Up @@ -17,10 +17,13 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "cainjector"

{{- with .Values.cainjector.podDisruptionBudget.minAvailable }}
minAvailable: {{ . }}
{{- if not (or (hasKey .Values.cainjector.podDisruptionBudget "minAvailable") (hasKey .Values.cainjector.podDisruptionBudget "maxUnavailable")) }}
minAvailable: 1 # Default value because minAvailable and maxUnavailable are not set
{{- end }}
{{- with .Values.cainjector.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ . }}
{{- if hasKey .Values.cainjector.podDisruptionBudget "minAvailable" }}
minAvailable: {{ .Values.cainjector.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if hasKey .Values.cainjector.podDisruptionBudget "maxUnavailable" }}
maxUnavailable: {{ .Values.cainjector.podDisruptionBudget.maxUnavailable }}
{{- end }}
{{- end }}
11 changes: 7 additions & 4 deletions deploy/charts/cert-manager/templates/poddisruptionbudget.yaml
Expand Up @@ -17,10 +17,13 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "controller"

{{- with .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ . }}
{{- if not (or (hasKey .Values.podDisruptionBudget "minAvailable") (hasKey .Values.podDisruptionBudget "maxUnavailable")) }}
minAvailable: 1 # Default value because minAvailable and maxUnavailable are not set
{{- end }}
{{- with .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ . }}
{{- if hasKey .Values.podDisruptionBudget "minAvailable" }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if hasKey .Values.podDisruptionBudget "maxUnavailable" }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
{{- end }}
Expand Up @@ -17,10 +17,13 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "webhook"

{{- with .Values.webhook.podDisruptionBudget.minAvailable }}
minAvailable: {{ . }}
{{- if not (or (hasKey .Values.webhook.podDisruptionBudget "minAvailable") (hasKey .Values.webhook.podDisruptionBudget "maxUnavailable")) }}
minAvailable: 1 # Default value because minAvailable and maxUnavailable are not set
{{- end }}
{{- with .Values.webhook.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ . }}
{{- if hasKey .Values.webhook.podDisruptionBudget "minAvailable" }}
minAvailable: {{ .Values.webhook.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if hasKey .Values.webhook.podDisruptionBudget "maxUnavailable" }}
maxUnavailable: {{ .Values.webhook.podDisruptionBudget.maxUnavailable }}
{{- end }}
{{- end }}
18 changes: 9 additions & 9 deletions deploy/charts/cert-manager/values.yaml
Expand Up @@ -63,11 +63,11 @@ strategy: {}
podDisruptionBudget:
enabled: false

minAvailable: 1
# maxUnavailable: 1

# minAvailable and maxUnavailable can either be set to an integer (e.g. 1)
# or a percentage value (e.g. 25%)
# if neither minAvailable or maxUnavailable is set, we default to `minAvailable: 1`
# minAvailable: 1
# maxUnavailable: 1

# Comma separated list of feature gates that should be enabled on the
# controller pod.
Expand Down Expand Up @@ -305,11 +305,11 @@ webhook:
podDisruptionBudget:
enabled: false

minAvailable: 1
# maxUnavailable: 1

# minAvailable and maxUnavailable can either be set to an integer (e.g. 1)
# or a percentage value (e.g. 25%)
# if neither minAvailable or maxUnavailable is set, we default to `minAvailable: 1`
# minAvailable: 1
# maxUnavailable: 1

# Container Security Context to be set on the webhook component container
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
Expand Down Expand Up @@ -490,11 +490,11 @@ cainjector:
podDisruptionBudget:
enabled: false

minAvailable: 1
# maxUnavailable: 1

# minAvailable and maxUnavailable can either be set to an integer (e.g. 1)
# or a percentage value (e.g. 25%)
# if neither minAvailable or maxUnavailable is set, we default to `minAvailable: 1`
# minAvailable: 1
# maxUnavailable: 1

# Container Security Context to be set on the cainjector component container
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
Expand Down