Skip to content

Commit

Permalink
Check chart controller image tag
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed Mar 16, 2020
1 parent 130af33 commit e9641ba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions charts/ingress-nginx/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,12 @@ Return the appropriate apiVersion for podSecurityPolicy.
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}

{{/*
Check the ingress controller version tag is at most three versions behind the last release
*/}}
{{- define "isControllerTagValid" -}}
{{- if not (semverCompare ">=0.27.0" .Values.controller.image.tag) -}}
{{- fail "Controller container image tag should be 0.27.0 or higher" -}}
{{- end -}}
{{- end -}}
1 change: 1 addition & 0 deletions charts/ingress-nginx/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if or (eq .Values.controller.kind "DaemonSet") (eq .Values.controller.kind "Both") -}}
{{- include "isControllerTagValid" . -}}
apiVersion: {{ template "daemonset.apiVersion" . }}
kind: DaemonSet
metadata:
Expand Down
1 change: 1 addition & 0 deletions charts/ingress-nginx/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both") -}}
{{- include "isControllerTagValid" . -}}
apiVersion: {{ template "deployment.apiVersion" . }}
kind: Deployment
metadata:
Expand Down

0 comments on commit e9641ba

Please sign in to comment.