Skip to content

Commit

Permalink
[app] add validatation for configMaps item has .data
Browse files Browse the repository at this point in the history
  • Loading branch information
dennybaa committed May 11, 2021
1 parent 747765b commit 7e98f84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dysnix/app/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: app
description: Generic application Helm chart
version: 0.3.2
version: 0.3.3
engine: gotpl
sources:
- https://github.com/dysnix/charts
Expand Down
12 changes: 12 additions & 0 deletions dysnix/app/templates/_validations.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Compile all warnings into a single message, and call fail.
{{- $messages := append $messages (include "app.validateValues.nameGiven" .) -}}
{{- $messages := append $messages (include "app.validateValues.imageRepositoryGiven" .) -}}
{{- $messages := append $messages (include "app.validateValues.noSecretsData" .) -}}
{{- $messages := append $messages (include "app.validateValues.noConfigMapsData" .) -}}
{{- $messages := append $messages (include "app.validateValues.ingressHasPortsProvided" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}
Expand Down Expand Up @@ -53,6 +54,17 @@ app: no-secrets-data-or-stringdata
{{- end -}}
{{- end -}}

{{/* Validate that configMaps have data given */}}
{{- define "app.validateValues.noConfigMapsData" -}}
{{- range $_, $values := .Values.configMaps -}}
{{- if not $values.data -}}
app: no-configmaps-data
Each item of .configMaps must have data field. Please
check the input configuration.
{{- end -}}
{{- end -}}
{{- end -}}

{{/* Validate that the enabled ingress has service ports provided */}}
{{- define "app.validateValues.ingressHasPortsProvided" -}}
{{- if and .Values.ingress.enabled (not (or .Values.service.port .Values.service.ports)) -}}
Expand Down

0 comments on commit 7e98f84

Please sign in to comment.