Skip to content

Commit 295efc2

Browse files
authored
fix: set apiVersion for PodDisruptionBudget depending on capabilities (#198)
fixes: #196
1 parent 764017c commit 295efc2

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

charts/kminion/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.11.0
18+
version: 0.11.1
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/kminion/templates/_helpers.tpl

+11
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,14 @@ Return if ingress supports pathType.
9595
{{- define "kminion.ingress.supportsPathType" -}}
9696
{{- or (eq (include "kminion.ingress.isStable" .) "true") (and (eq (include "kminion.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) }}
9797
{{- end }}
98+
99+
{{/*
100+
Return the appropriate apiVersion for podDisruptionBudget.
101+
*/}}
102+
{{- define "kminion.podDisruptionBudget.apiVersion" -}}
103+
{{- if $.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget" }}
104+
{{- print "policy/v1" }}
105+
{{- else }}
106+
{{- print "policy/v1beta1" }}
107+
{{- end }}
108+
{{- end }}

charts/kminion/templates/poddisruptionbudget.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if .Values.podDisruptionBudget }}
2-
apiVersion: policy/v1beta1
2+
apiVersion: {{ include "kminion.podDisruptionBudget.apiVersion" . }}
33
kind: PodDisruptionBudget
44
metadata:
55
name: {{ template "kminion.fullname" . }}
@@ -16,4 +16,4 @@ spec:
1616
selector:
1717
matchLabels:
1818
{{- include "kminion.selectorLabels" . | nindent 6}}
19-
{{- end }}
19+
{{- end }}

0 commit comments

Comments
 (0)