Skip to content

Commit

Permalink
fix: set apiVersion for PodDisruptionBudget depending on capabilities (
Browse files Browse the repository at this point in the history
…#198)

fixes: #196
  • Loading branch information
TheMeier authored Mar 29, 2023
1 parent 764017c commit 295efc2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/kminion/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.11.0
version: 0.11.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
11 changes: 11 additions & 0 deletions charts/kminion/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,14 @@ Return if ingress supports pathType.
{{- define "kminion.ingress.supportsPathType" -}}
{{- or (eq (include "kminion.ingress.isStable" .) "true") (and (eq (include "kminion.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) }}
{{- end }}

{{/*
Return the appropriate apiVersion for podDisruptionBudget.
*/}}
{{- define "kminion.podDisruptionBudget.apiVersion" -}}
{{- if $.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget" }}
{{- print "policy/v1" }}
{{- else }}
{{- print "policy/v1beta1" }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/kminion/templates/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.podDisruptionBudget }}
apiVersion: policy/v1beta1
apiVersion: {{ include "kminion.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "kminion.fullname" . }}
Expand All @@ -16,4 +16,4 @@ spec:
selector:
matchLabels:
{{- include "kminion.selectorLabels" . | nindent 6}}
{{- end }}
{{- end }}

0 comments on commit 295efc2

Please sign in to comment.