github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/kafka/charts/common/templates/_errors.tpl (about)

     1  {{/* vim: set filetype=mustache: */}}
     2  {{/*
     3  Through error when upgrading using empty passwords values that must not be empty.
     4  
     5  Usage:
     6  {{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
     7  {{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
     8  {{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
     9  
    10  Required password params:
    11    - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
    12    - context - Context - Required. Parent context.
    13  */}}
    14  {{- define "common.errors.upgrade.passwords.empty" -}}
    15    {{- $validationErrors := join "" .validationErrors -}}
    16    {{- if and $validationErrors .context.Release.IsUpgrade -}}
    17      {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}}
    18      {{- $errorString = print $errorString "\n                 Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}}
    19      {{- $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" -}}
    20      {{- $errorString = print $errorString "\n%s" -}}
    21      {{- printf $errorString $validationErrors | fail -}}
    22    {{- end -}}
    23  {{- end -}}