Skip to content

Commit

Permalink
chore(charts): define APIVersion template
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingdon Barrett committed Nov 2, 2019
1 parent 2df4300 commit cac151d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/examples/templates/apache-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: apache
Expand Down
2 changes: 1 addition & 1 deletion charts/examples/templates/nginx-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
Expand Down
9 changes: 9 additions & 0 deletions charts/router/templates/_helpers.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
2 changes: 1 addition & 1 deletion charts/router/templates/router-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if not .Values.global.experimental_native_ingress }}
apiVersion: {{ .Values.global.api_group }}
apiVersion: {{ template "APIVersion" . }}
kind: Deployment
metadata:
name: deis-router
Expand Down

0 comments on commit cac151d

Please sign in to comment.