Skip to content

Commit

Permalink
🌱 fix pdb issue in konnectivity-agent helm chart (#94)
Browse files Browse the repository at this point in the history
fix pdb issue in konnectivity-agent helm chart

we can only set maxUnavailable or minAvailable in the spec of pdb, not
both.

In the current helm chart, we have both set always and if one of the
keys is missing in the values.yaml then the block is empty in the
rendered manifest.

This is conflicting with with the spec of pdb.
this commit refactors the helm chart so that if we have only one key
then the generated manifest then should contain only that key not the
other one.

For example: If we have `minAvailable` defined then the generated
manifest shouldn't contain `maxUnavailable`

If the user defines both key in the values.yaml then that's wrong and
I've added a note for the same that only one out of minAvailable and
maxUnavailable should be defined.

Signed-off-by: kranurag7 <[email protected]>
  • Loading branch information
kranurag7 authored Jun 28, 2024
1 parent b9768f6 commit d8e7f36
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/konnectivity-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ dependencies:
alias: proportional-autoscaler
condition: proportional-autoscaler.enabled
appVersion: v1.8.9
version: 1.0.11
version: 1.0.12
8 changes: 6 additions & 2 deletions charts/konnectivity-agent/templates/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ metadata:
name: {{ include "konnectivity-agent.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
{{- if .Values.pdb.minAvailable }}
minAvailable: {{ .Values.pdb.minAvailable }}
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
{{- end }}
{{- if or .Values.pdb.maxUnavailable ( not .Values.pdb.minAvailable ) }}
maxUnavailable: {{ .Values.pdb.maxUnavailable | default 1 }}
{{- end }}
selector:
matchLabels:
{{- include "konnectivity-agent.selectorLabels" . | nindent 6 }}
{{- end }}
{{- end }}
3 changes: 2 additions & 1 deletion charts/konnectivity-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ ports:

pdb:
enabled: true
maxUnavailable: 2
# please note that you should only define one of minAvailable or maxUnavailable.
minAvailable: 1

serviceAccount:
# The name of the service account to use.
Expand Down

0 comments on commit d8e7f36

Please sign in to comment.