_validate.tpl 876 B

123456789101112131415161718
  1. {{/* Validates any object that it does not contain helm errors */}}
  2. {{/* This usually can happen after merging values from an include that did not render correcly */}}
  3. {{/* Any object will be passed to "toYaml" */}}
  4. {{/* Call this template:
  5. {{ include "ix.v1.common.values.validate" . }}
  6. */}}
  7. {{- define "ix.v1.common.values.validate" -}}
  8. {{- $allValues := (toYaml .) -}}
  9. {{- if contains "error converting YAML to JSON" $allValues -}}
  10. {{/* Print values to show values with the error included. */}}
  11. {{/* Ideally we would want to extract the error only, but because it usually contains ":",
  12. It gets parsed as dict and it cant regex matched it afterwards */}}
  13. {{- fail (printf "Chart - Values contain an error that may be a result of merging. Values containing the error: \n\n %v \n\n See error above values." $allValues) -}}
  14. {{- end -}}
  15. {{- end -}}