diff --git a/helm/druid/Chart.yaml b/helm/druid/Chart.yaml index 8bbc003de34f..cc4083be290e 100644 --- a/helm/druid/Chart.yaml +++ b/helm/druid/Chart.yaml @@ -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: diff --git a/helm/druid/templates/_capabilities.tpl b/helm/druid/templates/_capabilities.tpl new file mode 100644 index 000000000000..f0a0c861556f --- /dev/null +++ b/helm/druid/templates/_capabilities.tpl @@ -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 -}} diff --git a/helm/druid/templates/historical/pdb.yaml b/helm/druid/templates/historical/pdb.yaml index 13b000034c74..c921b1909da4 100644 --- a/helm/druid/templates/historical/pdb.yaml +++ b/helm/druid/templates/historical/pdb.yaml @@ -18,7 +18,7 @@ */}} {{- if .Values.historical.podDisruptionBudget.enabled }} -apiVersion: policy/v1beta1 +apiVersion: {{ include "capabilities.policy.apiVersion" . }} kind: PodDisruptionBudget metadata: labels: diff --git a/helm/druid/templates/middleManager/pdb.yaml b/helm/druid/templates/middleManager/pdb.yaml index 5e3bccf1aa78..71a592979a79 100644 --- a/helm/druid/templates/middleManager/pdb.yaml +++ b/helm/druid/templates/middleManager/pdb.yaml @@ -18,7 +18,7 @@ */}} {{- if .Values.middleManager.podDisruptionBudget.enabled }} -apiVersion: policy/v1beta1 +apiVersion: {{ include "capabilities.policy.apiVersion" . }} kind: PodDisruptionBudget metadata: labels: