_errors.tpl 1.7 KB

12345678910111213141516171819202122232425262728
  1. {{/*
  2. Copyright Broadcom, Inc. All Rights Reserved.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. {{/* vim: set filetype=mustache: */}}
  6. {{/*
  7. Through error when upgrading using empty passwords values that must not be empty.
  8. Usage:
  9. {{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
  10. {{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
  11. {{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
  12. Required password params:
  13. - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
  14. - context - Context - Required. Parent context.
  15. */}}
  16. {{- define "common.errors.upgrade.passwords.empty" -}}
  17. {{- $validationErrors := join "" .validationErrors -}}
  18. {{- if and $validationErrors .context.Release.IsUpgrade -}}
  19. {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}}
  20. {{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}}
  21. {{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}}
  22. {{- $errorString = print $errorString "\n%s" -}}
  23. {{- printf $errorString $validationErrors | fail -}}
  24. {{- end -}}
  25. {{- end -}}