added pdb version detection (#260)

* added pdb version detection

* refresh

* Update bookkeeper-pdb.yaml

update the capabilities syntax

* Update broker-pdb.yaml

update capability syntax

* Update proxy-pdb.yaml

update capability version syntax

* Update zookeeper-pdb.yaml

update capability version syntax

* Update zookeeper-pdb.yaml

fix typo

* Update bookkeeper-pdb.yaml

Co-authored-by: Marvin Cai <cai19930303@gmail.com>

Fixes pod disruption budget version warning

### Motivation

PDB policy api version, v1beta1 is deprecated in k8s1.21+ (not available in 1.25+).

### Modifications

zookeeper-pdb, proxy-pdb, broker-pdb and bookkeepr-pdb templates are modified.  If k8s api-resources container policy/v1, the *-pdb.yaml will generate respective apiVersion. 

### Verifying this change

- [ ] Make sure that the change passes the CI checks.
This commit is contained in:
Yuwei Sung 2022-10-18 22:52:11 -05:00 committed by GitHub
parent 89f28bca9c
commit 816d88c942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 0 deletions

View File

@ -19,7 +19,12 @@
{{- if .Values.components.bookkeeper }} {{- if .Values.components.bookkeeper }}
{{- if .Values.bookkeeper.pdb.usePolicy }} {{- if .Values.bookkeeper.pdb.usePolicy }}
# pdb version detection
{{- if semverCompare "<1.21-0" .Capabilities.KubeVersion.Version }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
{{- else }}
apiVersion: policy/v1
{{- end }}
kind: PodDisruptionBudget kind: PodDisruptionBudget
metadata: metadata:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}" name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}"

View File

@ -19,7 +19,12 @@
{{- if .Values.components.broker }} {{- if .Values.components.broker }}
{{- if .Values.broker.pdb.usePolicy }} {{- if .Values.broker.pdb.usePolicy }}
# pdb version detection
{{- if semverCompare "<1.21-0" .Capabilities.KubeVersion.Version }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
{{- else }}
apiVersion: policy/v1
{{- end }}
kind: PodDisruptionBudget kind: PodDisruptionBudget
metadata: metadata:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}" name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"

View File

@ -19,7 +19,12 @@
{{- if or .Values.components.proxy .Values.extra.proxy }} {{- if or .Values.components.proxy .Values.extra.proxy }}
{{- if .Values.proxy.pdb.usePolicy }} {{- if .Values.proxy.pdb.usePolicy }}
# pdb version detection
{{- if semverCompare "<1.21-0" .Capabilities.KubeVersion.Version }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
{{- else }}
apiVersion: policy/v1
{{- end }}
kind: PodDisruptionBudget kind: PodDisruptionBudget
metadata: metadata:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}" name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"

View File

@ -20,7 +20,12 @@
# deploy zookeeper only when `components.zookeeper` is true # deploy zookeeper only when `components.zookeeper` is true
{{- if .Values.components.zookeeper }} {{- if .Values.components.zookeeper }}
{{- if .Values.zookeeper.pdb.usePolicy }} {{- if .Values.zookeeper.pdb.usePolicy }}
# pdb version detection
{{- if semverCompare "<1.21-0" .Capabilities.KubeVersion.Version }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
{{- else }}
apiVersion: policy/v1
{{- end }}
kind: PodDisruptionBudget kind: PodDisruptionBudget
metadata: metadata:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}" name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"