This is an automated email from the ASF dual-hosted git repository.

mmarshall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
     new 816d88c  added pdb version detection (#260)
816d88c is described below

commit 816d88c942e5f1d13e1f11d67708dd16aa02c388
Author: Yuwei Sung <[email protected]>
AuthorDate: Tue Oct 18 22:52:11 2022 -0500

    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 <[email protected]>
    
    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.
---
 charts/pulsar/templates/bookkeeper-pdb.yaml | 5 +++++
 charts/pulsar/templates/broker-pdb.yaml     | 5 +++++
 charts/pulsar/templates/proxy-pdb.yaml      | 5 +++++
 charts/pulsar/templates/zookeeper-pdb.yaml  | 5 +++++
 4 files changed, 20 insertions(+)

diff --git a/charts/pulsar/templates/bookkeeper-pdb.yaml 
b/charts/pulsar/templates/bookkeeper-pdb.yaml
index 74e1503..3af8290 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 c03aca6..ec7555c 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 befdccc..f39970d 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 387a05a..70f88f9 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 }}"

Reply via email to