Skip to content

Commit

Permalink
helm: Fix PDB apiVersion to allow K8s 1.25+ deployment (apache#13783)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwitko authored Feb 15, 2023
1 parent 9ffaba9 commit 355cdbe
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion helm/druid/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies:
version: 8.6.4
repository: https://charts.helm.sh/stable
condition: postgresql.enabled
version: 0.3.3
version: 0.3.4
home: https://druid.apache.org/
icon: https://druid.apache.org/img/favicon.png
sources:
Expand Down
17 changes: 17 additions & 0 deletions helm/druid/templates/_capabilities.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{/*
Return the target Kubernetes version
*/}}
{{- define "capabilities.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for poddisruptionbudget.
*/}}
{{- define "capabilities.policy.apiVersion" -}}
{{- if semverCompare "<1.21-0" (include "capabilities.kubeVersion" .) -}}
{{- print "policy/v1beta1" -}}
{{- else -}}
{{- print "policy/v1" -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion helm/druid/templates/historical/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/}}

{{- if .Values.historical.podDisruptionBudget.enabled }}
apiVersion: policy/v1beta1
apiVersion: {{ include "capabilities.policy.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion helm/druid/templates/middleManager/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/}}

{{- if .Values.middleManager.podDisruptionBudget.enabled }}
apiVersion: policy/v1beta1
apiVersion: {{ include "capabilities.policy.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
labels:
Expand Down

0 comments on commit 355cdbe

Please sign in to comment.