diff --git a/charts/controller/templates/_helpers.tmpl b/charts/controller/templates/_helpers.tmpl index 422a5ae3f..cf80f4c81 100644 --- a/charts/controller/templates/_helpers.tmpl +++ b/charts/controller/templates/_helpers.tmpl @@ -10,3 +10,12 @@ rbac.authorization.k8s.io/v1alpha1 rbac.authorization.k8s.io/v1 {{- end -}} {{- end -}} +{{- define "APIVersion" -}} +{{- if .Capabilities.APIVersions.Has "apps/v1" -}} +apps/v1 +{{- else if .Capabilities.APIVersions.Has "extensions/v1beta1" -}} +extensions/v1beta1 +{{- else -}} +apps/v1 +{{- end -}} +{{- end -}} diff --git a/charts/controller/templates/controller-deployment.yaml b/charts/controller/templates/controller-deployment.yaml index 09231c326..b9a5a688d 100644 --- a/charts/controller/templates/controller-deployment.yaml +++ b/charts/controller/templates/controller-deployment.yaml @@ -1,10 +1,4 @@ -{{- if .Capabilities.APIVersions.Has "apps/v1" }} -apiVersion: apps/v1 -{{- else if .Capabilities.APIVersions.Has "extensions/v1beta1" }} -apiVersion: extensions/v1beta1 -{{- else }} -apiVersion: apps/v1 -{{- end }} +apiVersion: {{ template "APIVersion" . }} kind: Deployment metadata: name: deis-controller