diff --git a/charts/pulsar/templates/bookkeeper-pdb.yaml b/charts/pulsar/templates/bookkeeper-pdb.yaml index 74e15039..3af8290c 100644 --- a/charts/pulsar/templates/bookkeeper-pdb.yaml +++ b/charts/pulsar/templates/bookkeeper-pdb.yaml @@ -19,7 +19,12 @@ {{- if .Values.components.bookkeeper }} {{- if .Values.bookkeeper.pdb.usePolicy }} +# pdb version detection +{{- if semverCompare "<1.21-0" .Capabilities.KubeVersion.Version }} apiVersion: policy/v1beta1 +{{- else }} +apiVersion: policy/v1 +{{- end }} kind: PodDisruptionBudget metadata: name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}" diff --git a/charts/pulsar/templates/broker-pdb.yaml b/charts/pulsar/templates/broker-pdb.yaml index c03aca63..ec7555cd 100644 --- a/charts/pulsar/templates/broker-pdb.yaml +++ b/charts/pulsar/templates/broker-pdb.yaml @@ -19,7 +19,12 @@ {{- if .Values.components.broker }} {{- if .Values.broker.pdb.usePolicy }} +# pdb version detection +{{- if semverCompare "<1.21-0" .Capabilities.KubeVersion.Version }} apiVersion: policy/v1beta1 +{{- else }} +apiVersion: policy/v1 +{{- end }} kind: PodDisruptionBudget metadata: name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}" diff --git a/charts/pulsar/templates/proxy-pdb.yaml b/charts/pulsar/templates/proxy-pdb.yaml index befdccc0..f39970df 100644 --- a/charts/pulsar/templates/proxy-pdb.yaml +++ b/charts/pulsar/templates/proxy-pdb.yaml @@ -19,7 +19,12 @@ {{- if or .Values.components.proxy .Values.extra.proxy }} {{- if .Values.proxy.pdb.usePolicy }} +# pdb version detection +{{- if semverCompare "<1.21-0" .Capabilities.KubeVersion.Version }} apiVersion: policy/v1beta1 +{{- else }} +apiVersion: policy/v1 +{{- end }} kind: PodDisruptionBudget metadata: name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}" diff --git a/charts/pulsar/templates/zookeeper-pdb.yaml b/charts/pulsar/templates/zookeeper-pdb.yaml index 387a05ae..70f88f96 100644 --- a/charts/pulsar/templates/zookeeper-pdb.yaml +++ b/charts/pulsar/templates/zookeeper-pdb.yaml @@ -20,7 +20,12 @@ # deploy zookeeper only when `components.zookeeper` is true {{- if .Values.components.zookeeper }} {{- if .Values.zookeeper.pdb.usePolicy }} +# pdb version detection +{{- if semverCompare "<1.21-0" .Capabilities.KubeVersion.Version }} apiVersion: policy/v1beta1 +{{- else }} +apiVersion: policy/v1 +{{- end }} kind: PodDisruptionBudget metadata: name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"