From 838cbe6389d25f596b4b15ffc98233d8d6ee75f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=B6ran=20P=C3=B6hner?=
 <10630407+groundhog2k@users.noreply.github.com>
Date: Mon, 6 Feb 2023 13:50:32 +0100
Subject: [PATCH] Update version detection for PDB deployment (#1206)

---
 charts/commento/Chart.yaml          | 4 ++--
 charts/commento/README.md           | 2 +-
 charts/commento/RELEASENOTES.md     | 1 +
 charts/commento/templates/pdp.yaml  | 2 +-
 charts/graylog/Chart.yaml           | 6 +++---
 charts/graylog/README.md            | 2 +-
 charts/graylog/RELEASENOTES.md      | 1 +
 charts/graylog/templates/pdp.yaml   | 2 +-
 charts/nextcloud/Chart.yaml         | 8 ++++----
 charts/nextcloud/README.md          | 2 +-
 charts/nextcloud/RELEASENOTES.md    | 1 +
 charts/nextcloud/templates/pdp.yaml | 2 +-
 charts/rabbitmq/Chart.yaml          | 2 +-
 charts/rabbitmq/README.md           | 2 +-
 charts/rabbitmq/RELEASENOTES.md     | 1 +
 charts/rabbitmq/templates/pdb.yaml  | 2 +-
 charts/redis/Chart.yaml             | 4 ++--
 charts/redis/README.md              | 2 +-
 charts/redis/RELEASENOTES.md        | 1 +
 charts/redis/templates/pdp.yaml     | 2 +-
 charts/wordpress/Chart.yaml         | 4 ++--
 charts/wordpress/README.md          | 2 +-
 charts/wordpress/RELEASENOTES.md    | 1 +
 charts/wordpress/templates/pdp.yaml | 2 +-
 24 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/charts/commento/Chart.yaml b/charts/commento/Chart.yaml
index 3a0d09fe..2992ba88 100644
--- a/charts/commento/Chart.yaml
+++ b/charts/commento/Chart.yaml
@@ -7,12 +7,12 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.1.32
+version: "0.1.33"
 
 appVersion: "v1.8.0"
 
 dependencies:
   - name: postgres
-    version: 0.2.23
+    version: "0.2.23"
     repository: "https://groundhog2k.github.io/helm-charts"
     condition: postgres.enabled
diff --git a/charts/commento/README.md b/charts/commento/README.md
index 4e7def32..dcfffaec 100644
--- a/charts/commento/README.md
+++ b/charts/commento/README.md
@@ -1,6 +1,6 @@
 # Commento
 
-![Version: 0.1.32](https://img.shields.io/badge/Version-0.1.32-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.8.0](https://img.shields.io/badge/AppVersion-v1.8.0-informational?style=flat-square)
+![Version: 0.1.33](https://img.shields.io/badge/Version-0.1.33-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.8.0](https://img.shields.io/badge/AppVersion-v1.8.0-informational?style=flat-square)
 
 ## Changelog
 
diff --git a/charts/commento/RELEASENOTES.md b/charts/commento/RELEASENOTES.md
index baed2567..beb1ff3a 100644
--- a/charts/commento/RELEASENOTES.md
+++ b/charts/commento/RELEASENOTES.md
@@ -14,4 +14,5 @@
 | 0.1.30 | v1.8.0 | Updated chart dependencies (postgres 0.2.22) |
 | 0.1.31 | v1.8.0 | Updated chart dependencies (postgres 0.2.23) |
 | 0.1.32 | v1.8.0 | Fixed values documentation - thx @generalovmaksim |
+| 0.1.33 | v1.8.0 | Updated version detection for pod disruption budget |
 | | | |
diff --git a/charts/commento/templates/pdp.yaml b/charts/commento/templates/pdp.yaml
index ebbbb255..591da2f1 100644
--- a/charts/commento/templates/pdp.yaml
+++ b/charts/commento/templates/pdp.yaml
@@ -1,5 +1,5 @@
 {{- if and (.Values.podDisruptionBudget) (or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable) }}
-{{- if semverCompare ">=1.21" .Capabilities.KubeVersion.Version }}
+{{- if .Capabilities.APIVersions.Has "policy/v1" }}
 apiVersion: policy/v1
 {{- else }}
 apiVersion: policy/v1beta1
diff --git a/charts/graylog/Chart.yaml b/charts/graylog/Chart.yaml
index 75be3739..487e0ada 100644
--- a/charts/graylog/Chart.yaml
+++ b/charts/graylog/Chart.yaml
@@ -7,16 +7,16 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: "0.5.4"
+version: "0.5.5"
 
 appVersion: "5.0.3"
 
 dependencies:
   - name: mongodb
-    version: 0.4.16
+    version: "0.4.16"
     repository: "https://groundhog2k.github.io/helm-charts"
     condition: mongodb.enabled
   - name: elasticsearch
-    version: 0.1.106
+    version: "0.1.106"
     repository: "https://groundhog2k.github.io/helm-charts"
     condition: elasticsearch.enabled
diff --git a/charts/graylog/README.md b/charts/graylog/README.md
index f1664c76..c64c8f69 100644
--- a/charts/graylog/README.md
+++ b/charts/graylog/README.md
@@ -1,6 +1,6 @@
 # Graylog
 
-![Version: 0.5.4](https://img.shields.io/badge/Version-0.5.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 5.0.3](https://img.shields.io/badge/AppVersion-5.0.3-informational?style=flat-square)
+![Version: 0.5.5](https://img.shields.io/badge/Version-0.5.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 5.0.3](https://img.shields.io/badge/AppVersion-5.0.3-informational?style=flat-square)
 
 ## Changelog
 
diff --git a/charts/graylog/RELEASENOTES.md b/charts/graylog/RELEASENOTES.md
index 41eb1e34..ddfe06d6 100644
--- a/charts/graylog/RELEASENOTES.md
+++ b/charts/graylog/RELEASENOTES.md
@@ -38,4 +38,5 @@
 | 0.5.2 | 5.0.2 | Updated chart for Graylog 5.0.2 and chart dependencies (mongodb 0.4.16) |
 | 0.5.3 | 5.0.2 | Fixed values documentation - thx @generalovmaksim |
 | 0.5.4 | 5.0.3 | Updated chart for Graylog 5.0.3 | 
+| 0.5.5 | 5.0.3 | Updated version detection for pod disruption budget |
 | | | |
diff --git a/charts/graylog/templates/pdp.yaml b/charts/graylog/templates/pdp.yaml
index cfc40797..1ba2aade 100644
--- a/charts/graylog/templates/pdp.yaml
+++ b/charts/graylog/templates/pdp.yaml
@@ -1,5 +1,5 @@
 {{- if and (.Values.podDisruptionBudget) (or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable) }}
-{{- if semverCompare ">=1.21" .Capabilities.KubeVersion.Version }}
+{{- if .Capabilities.APIVersions.Has "policy/v1" }}
 apiVersion: policy/v1
 {{- else }}
 apiVersion: policy/v1beta1
diff --git a/charts/nextcloud/Chart.yaml b/charts/nextcloud/Chart.yaml
index 09ed2833..121d1157 100644
--- a/charts/nextcloud/Chart.yaml
+++ b/charts/nextcloud/Chart.yaml
@@ -8,21 +8,21 @@ maintainers:
   - name: groundhog2k
 
 # This is the chart version.
-version: 0.12.7
+version: "0.12.8"
 
 # This is the version number of the application being deployed.
 appVersion: "25.0.3-apache"
 
 dependencies:
   - name: mariadb
-    version: 0.2.24
+    version: "0.2.24"
     repository: "https://groundhog2k.github.io/helm-charts"
     condition: mariadb.enabled
   - name: postgres
-    version: 0.2.23
+    version: "0.2.23"
     repository: "https://groundhog2k.github.io/helm-charts"
     condition: postgres.enabled
   - name: redis
-    version: 0.6.1
+    version: "0.6.1"
     repository: "https://groundhog2k.github.io/helm-charts"
     condition: redis.enabled
diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md
index c9cf4fee..9721096a 100644
--- a/charts/nextcloud/README.md
+++ b/charts/nextcloud/README.md
@@ -1,6 +1,6 @@
 # Nextcloud
 
-![Version: 0.12.7](https://img.shields.io/badge/Version-0.12.7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 25.0.3-apache](https://img.shields.io/badge/AppVersion-25.0.3-informational?style=flat-square)
+![Version: 0.12.8](https://img.shields.io/badge/Version-0.12.8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 25.0.3-apache](https://img.shields.io/badge/AppVersion-25.0.3-informational?style=flat-square)
 
 ## Changelog
 
diff --git a/charts/nextcloud/RELEASENOTES.md b/charts/nextcloud/RELEASENOTES.md
index 530fef2f..70f1b2d8 100644
--- a/charts/nextcloud/RELEASENOTES.md
+++ b/charts/nextcloud/RELEASENOTES.md
@@ -34,4 +34,5 @@
 | 0.12.5 | 25.0.2-apache | Updated chart dependencies (redis 0.6.0) |
 | 0.12.6 | 25.0.2-apache | Fixed valued documentation - thx @generalovmaksim |
 | 0.12.7 | 25.0.3-apache | Upgraded to Nextcloud 25.0.3 and dependencies (redis 0.6.1) |
+| 0.12.8 | 25.0.3-apache | Updated version detection for pod disruption budget |
 | | | |
diff --git a/charts/nextcloud/templates/pdp.yaml b/charts/nextcloud/templates/pdp.yaml
index b8f305c4..845738a0 100644
--- a/charts/nextcloud/templates/pdp.yaml
+++ b/charts/nextcloud/templates/pdp.yaml
@@ -1,5 +1,5 @@
 {{- if and (.Values.podDisruptionBudget) (or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable) }}
-{{- if semverCompare ">=1.21" .Capabilities.KubeVersion.Version }}
+{{- if .Capabilities.APIVersions.Has "policy/v1" }}
 apiVersion: policy/v1
 {{- else }}
 apiVersion: policy/v1beta1
diff --git a/charts/rabbitmq/Chart.yaml b/charts/rabbitmq/Chart.yaml
index a3697375..39e77f8a 100644
--- a/charts/rabbitmq/Chart.yaml
+++ b/charts/rabbitmq/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: "0.6.8"
+version: "0.6.9"
 
 appVersion: "3.11.8"
diff --git a/charts/rabbitmq/README.md b/charts/rabbitmq/README.md
index 019a1428..93b40660 100644
--- a/charts/rabbitmq/README.md
+++ b/charts/rabbitmq/README.md
@@ -1,6 +1,6 @@
 # RabbitMQ
 
-![Version: 0.6.8](https://img.shields.io/badge/Version-0.6.8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.11.8](https://img.shields.io/badge/AppVersion-3.11.8-informational?style=flat-square)
+![Version: 0.6.9](https://img.shields.io/badge/Version-0.6.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.11.8](https://img.shields.io/badge/AppVersion-3.11.8-informational?style=flat-square)
 
 ## Changelog
 
diff --git a/charts/rabbitmq/RELEASENOTES.md b/charts/rabbitmq/RELEASENOTES.md
index 896735b3..1490a700 100644
--- a/charts/rabbitmq/RELEASENOTES.md
+++ b/charts/rabbitmq/RELEASENOTES.md
@@ -60,4 +60,5 @@
 | 0.6.6 | 3.11.6 | Upgraded to RabbitMQ 3.11.6 |
 | 0.6.7 | 3.11.7 | Upgraded to RabbitMQ 3.11.7 |
 | 0.6.8 | 3.11.8 | Upgraded to RabbitMQ 3.11.8 |
+| 0.6.8 | 3.11.8 | Updated version detection for pod disruption budget |
 | | | |
diff --git a/charts/rabbitmq/templates/pdb.yaml b/charts/rabbitmq/templates/pdb.yaml
index c5c2f0ad..55ebcd4f 100644
--- a/charts/rabbitmq/templates/pdb.yaml
+++ b/charts/rabbitmq/templates/pdb.yaml
@@ -1,5 +1,5 @@
 {{- if and (.Values.podDisruptionBudget) (or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable) }}
-{{- if semverCompare ">=1.21" .Capabilities.KubeVersion.Version }}
+{{- if .Capabilities.APIVersions.Has "policy/v1" }}
 apiVersion: policy/v1
 {{- else }}
 apiVersion: policy/v1beta1
diff --git a/charts/redis/Chart.yaml b/charts/redis/Chart.yaml
index 7ca71462..4fce0ac6 100644
--- a/charts/redis/Chart.yaml
+++ b/charts/redis/Chart.yaml
@@ -8,7 +8,7 @@ maintainers:
   - name: groundhog2k
 
 # This is the chart version
-version: 0.4.13
+version: "0.6.2"
 
 # This is the version number of the application being deployed.
-appVersion: "6.2.10"
+appVersion: "7.0.8"
diff --git a/charts/redis/README.md b/charts/redis/README.md
index 1bcc6653..607c5984 100644
--- a/charts/redis/README.md
+++ b/charts/redis/README.md
@@ -1,6 +1,6 @@
 # Redis
 
-![Version: 0.6.1](https://img.shields.io/badge/Version-0.6.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 7.0.8](https://img.shields.io/badge/AppVersion-7.0.8-informational?style=flat-square)
+![Version: 0.6.2](https://img.shields.io/badge/Version-0.6.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 7.0.8](https://img.shields.io/badge/AppVersion-7.0.8-informational?style=flat-square)
 
 ## Changelog
 
diff --git a/charts/redis/RELEASENOTES.md b/charts/redis/RELEASENOTES.md
index 0dc62b14..898305b3 100644
--- a/charts/redis/RELEASENOTES.md
+++ b/charts/redis/RELEASENOTES.md
@@ -19,4 +19,5 @@
 | 0.5.10 | 7.0.7 | Upgraded to Redis 7.0.7 |
 | 0.6.0 | 7.0.7 | Implemented alternative DNS option for cluster building |
 | 0.6.1 | 7.0.8 | Upgraded to Redis 7.0.8 |
+| 0.6.2 | 7.0.8 | Updated version detection for pod disruption budget |
 | | | |
diff --git a/charts/redis/templates/pdp.yaml b/charts/redis/templates/pdp.yaml
index bec0d88c..2bd2b97f 100644
--- a/charts/redis/templates/pdp.yaml
+++ b/charts/redis/templates/pdp.yaml
@@ -1,5 +1,5 @@
 {{- if and (.Values.podDisruptionBudget) (or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable) }}
-{{- if semverCompare ">=1.21" .Capabilities.KubeVersion.Version }}
+{{- if .Capabilities.APIVersions.Has "policy/v1" }}
 apiVersion: policy/v1
 {{- else }}
 apiVersion: policy/v1beta1
diff --git a/charts/wordpress/Chart.yaml b/charts/wordpress/Chart.yaml
index c6025d7b..17e9a128 100644
--- a/charts/wordpress/Chart.yaml
+++ b/charts/wordpress/Chart.yaml
@@ -8,13 +8,13 @@ maintainers:
 type: application
 
 # This is the chart version.
-version: 0.7.3
+version: "0.7.4"
 
 # This is the version number of the application being deployed.
 appVersion: "6.1.1-apache"
 
 dependencies:
   - name: mariadb
-    version: 0.2.24
+    version: "0.2.24"
     repository: "https://groundhog2k.github.io/helm-charts"
     condition: mariadb.enabled
diff --git a/charts/wordpress/README.md b/charts/wordpress/README.md
index b81c13e6..230d6a76 100644
--- a/charts/wordpress/README.md
+++ b/charts/wordpress/README.md
@@ -1,6 +1,6 @@
 # Wordpress
 
-![Version: 0.7.3](https://img.shields.io/badge/Version-0.7.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.1.1-apache](https://img.shields.io/badge/AppVersion-6.1.1--apache-informational?style=flat-square)
+![Version: 0.7.4](https://img.shields.io/badge/Version-0.7.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.1.1-apache](https://img.shields.io/badge/AppVersion-6.1.1--apache-informational?style=flat-square)
 
 ## Changelog
 
diff --git a/charts/wordpress/RELEASENOTES.md b/charts/wordpress/RELEASENOTES.md
index efc2dd96..2ecc1d45 100644
--- a/charts/wordpress/RELEASENOTES.md
+++ b/charts/wordpress/RELEASENOTES.md
@@ -21,4 +21,5 @@
 | 0.7.1 | 6.1.1-apache | Upgraded to Wordpress 6.1.1 |
 | 0.7.2 | 6.1.1-apache | Updated chart dependencies (mariadb 0.2.24) |
 | 0.7.3 | 6.1.1-apache | Fixed values documentation - thx @generalovmaksim |
+| 0.7.4 | 6.1.1-apache | Updated version detection for pod disruption budget |
 | | | |
diff --git a/charts/wordpress/templates/pdp.yaml b/charts/wordpress/templates/pdp.yaml
index 29316d2c..e09e6dae 100644
--- a/charts/wordpress/templates/pdp.yaml
+++ b/charts/wordpress/templates/pdp.yaml
@@ -1,5 +1,5 @@
 {{- if and (.Values.podDisruptionBudget) (or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable) }}
-{{- if semverCompare ">=1.21" .Capabilities.KubeVersion.Version }}
+{{- if .Capabilities.APIVersions.Has "policy/v1" }}
 apiVersion: policy/v1
 {{- else }}
 apiVersion: policy/v1beta1
-- 
GitLab