From f4cb1dfdb770f611b877d1a375558f697c41a1cc Mon Sep 17 00:00:00 2001 From: Tom Hayward Date: Wed, 1 Dec 2021 11:18:32 -0800 Subject: [PATCH] workaround for .Capabilities.APIVersions Signed-off-by: Tom Hayward --- CHANGELOG.md | 1 + templates/alertmanager/alertmanager-poddisruptionbudget.yaml | 2 +- templates/compactor/compactor-poddisruptionbudget.yaml | 2 +- templates/configs/configs-poddisruptionbudget.yaml | 2 +- templates/distributor/distributor-poddisruptionbudget.yaml | 2 +- templates/ingester/ingester-poddisruptionbudget.yaml | 2 +- templates/nginx/nginx-poddisruptionbudget.yaml | 2 +- templates/querier/querier-poddisruptionbudget.yaml | 2 +- templates/query-frontend/query-poddisruptionbudget.yaml | 2 +- templates/ruler/ruler-poddisruptionbudget.yaml | 2 +- templates/store-gateway/store-gateway-poddisruptionbudget.yaml | 2 +- templates/table-manager/table-manager-poddisruptionbudget.yaml | 2 +- 12 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cffb93a1..b4f4f7c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * [CHANGE] Enable bucket index by default #275 * [CHANGE] Disable ingester liveness probes by default. #263 * [FEATURE] Allow different service accounts per dep/statefulset. #264 +* [BUGFIX] workaround for .Capabilities.APIVersions. #277 ## 1.0.1 / 2021-11-26 * [BUGFIX] alertmanager/ruler deployment: fix indentation #266 diff --git a/templates/alertmanager/alertmanager-poddisruptionbudget.yaml b/templates/alertmanager/alertmanager-poddisruptionbudget.yaml index 91624a13..a9a7a678 100644 --- a/templates/alertmanager/alertmanager-poddisruptionbudget.yaml +++ b/templates/alertmanager/alertmanager-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (gt (int .Values.alertmanager.replicas) 1) (.Values.alertmanager.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 diff --git a/templates/compactor/compactor-poddisruptionbudget.yaml b/templates/compactor/compactor-poddisruptionbudget.yaml index cc6f5d8d..fa89d46e 100644 --- a/templates/compactor/compactor-poddisruptionbudget.yaml +++ b/templates/compactor/compactor-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (gt (int .Values.compactor.replicas) 1) (.Values.compactor.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 diff --git a/templates/configs/configs-poddisruptionbudget.yaml b/templates/configs/configs-poddisruptionbudget.yaml index 645aac34..a4c0848a 100644 --- a/templates/configs/configs-poddisruptionbudget.yaml +++ b/templates/configs/configs-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (gt (int .Values.configs.replicas) 1) (.Values.configs.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 diff --git a/templates/distributor/distributor-poddisruptionbudget.yaml b/templates/distributor/distributor-poddisruptionbudget.yaml index 32c28c80..a97b5f43 100644 --- a/templates/distributor/distributor-poddisruptionbudget.yaml +++ b/templates/distributor/distributor-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (gt (int .Values.distributor.replicas) 1) (.Values.distributor.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 diff --git a/templates/ingester/ingester-poddisruptionbudget.yaml b/templates/ingester/ingester-poddisruptionbudget.yaml index 1707349e..47a695c8 100644 --- a/templates/ingester/ingester-poddisruptionbudget.yaml +++ b/templates/ingester/ingester-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (gt (int .Values.ingester.replicas) 1) (.Values.ingester.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 diff --git a/templates/nginx/nginx-poddisruptionbudget.yaml b/templates/nginx/nginx-poddisruptionbudget.yaml index 8560f892..eef8e90a 100644 --- a/templates/nginx/nginx-poddisruptionbudget.yaml +++ b/templates/nginx/nginx-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (.Values.nginx.enabled) (gt (int .Values.nginx.replicas) 1) (.Values.nginx.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 diff --git a/templates/querier/querier-poddisruptionbudget.yaml b/templates/querier/querier-poddisruptionbudget.yaml index ad42e3fe..c0ff76c7 100644 --- a/templates/querier/querier-poddisruptionbudget.yaml +++ b/templates/querier/querier-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (gt (int .Values.querier.replicas) 1) (.Values.querier.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 diff --git a/templates/query-frontend/query-poddisruptionbudget.yaml b/templates/query-frontend/query-poddisruptionbudget.yaml index 368fc879..4136d9a6 100644 --- a/templates/query-frontend/query-poddisruptionbudget.yaml +++ b/templates/query-frontend/query-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (gt (int .Values.query_frontend.replicas) 1) (.Values.query_frontend.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 diff --git a/templates/ruler/ruler-poddisruptionbudget.yaml b/templates/ruler/ruler-poddisruptionbudget.yaml index 6df63c7f..053398be 100644 --- a/templates/ruler/ruler-poddisruptionbudget.yaml +++ b/templates/ruler/ruler-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (gt (int .Values.ruler.replicas) 1) (.Values.ruler.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 diff --git a/templates/store-gateway/store-gateway-poddisruptionbudget.yaml b/templates/store-gateway/store-gateway-poddisruptionbudget.yaml index add3e498..d97bfa10 100644 --- a/templates/store-gateway/store-gateway-poddisruptionbudget.yaml +++ b/templates/store-gateway/store-gateway-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (gt (int .Values.store_gateway.replicas) 1) (.Values.store_gateway.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 diff --git a/templates/table-manager/table-manager-poddisruptionbudget.yaml b/templates/table-manager/table-manager-poddisruptionbudget.yaml index 5e350914..c8d279f6 100644 --- a/templates/table-manager/table-manager-poddisruptionbudget.yaml +++ b/templates/table-manager/table-manager-poddisruptionbudget.yaml @@ -1,5 +1,5 @@ {{- if and (gt (int .Values.table_manager.replicas) 1) (.Values.table_manager.podDisruptionBudget) }} -{{- if .Capabilities.APIVersions.Has "policy/v1"}} +{{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21" .Capabilities.KubeVersion.Version) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1