From efe75e6a273bfff724f21773e0d2a246bbe9c2ab Mon Sep 17 00:00:00 2001 From: virtyaluk Date: Tue, 9 Jul 2024 14:53:48 +0200 Subject: [PATCH] fix(vault-operator helm chart): added missing common.capabilities.kubeVersion and common.capabilities.policy.apiVersion template definitions. Signed-off-by: virtyaluk --- .../vault-operator/templates/_helpers.tpl | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/deploy/charts/vault-operator/templates/_helpers.tpl b/deploy/charts/vault-operator/templates/_helpers.tpl index c258cbb5..32295525 100644 --- a/deploy/charts/vault-operator/templates/_helpers.tpl +++ b/deploy/charts/vault-operator/templates/_helpers.tpl @@ -1,4 +1,24 @@ {{/* vim: set filetype=mustache: */}} + +{{/* +Return the target Kubernetes version +*/}} +{{- define "common.capabilities.kubeVersion" -}} +{{- default (default .Capabilities.KubeVersion.Version .Values.kubeVersion) ((.Values.global).kubeVersion) -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for poddisruptionbudget. +*/}} +{{- define "common.capabilities.policy.apiVersion" -}} +{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} +{{- if and (not (empty $kubeVersion)) (semverCompare "<1.21-0" $kubeVersion) -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "policy/v1" -}} +{{- end -}} +{{- end -}} + {{/* Expand the name of the chart. */}}