aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common/mongodb/common/templates/_errors.tpl
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2024-03-11 15:39:30 +0000
committerGerrit Code Review <gerrit@onap.org>2024-03-11 15:39:30 +0000
commitfa01ec554cfa10cb1f9ec8be0c5530dd3f3ea50a (patch)
tree0f21b55af795554e19a745a4dcb0b063eb7ff18a /kubernetes/common/mongodb/common/templates/_errors.tpl
parent9964927d8766c5c396ef2caf6f7aeb7494db279e (diff)
parentcde4a784a593555c17146635dcc25013872cabc5 (diff)
Merge "[MONGODB] Update to latest bitnami mongodb chart"
Diffstat (limited to 'kubernetes/common/mongodb/common/templates/_errors.tpl')
-rw-r--r--kubernetes/common/mongodb/common/templates/_errors.tpl28
1 files changed, 28 insertions, 0 deletions
diff --git a/kubernetes/common/mongodb/common/templates/_errors.tpl b/kubernetes/common/mongodb/common/templates/_errors.tpl
new file mode 100644
index 0000000000..07ded6f64d
--- /dev/null
+++ b/kubernetes/common/mongodb/common/templates/_errors.tpl
@@ -0,0 +1,28 @@
+{{/*
+Copyright VMware, Inc.
+SPDX-License-Identifier: APACHE-2.0
+*/}}
+
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Through error when upgrading using empty passwords values that must not be empty.
+
+Usage:
+{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
+{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
+{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
+
+Required password params:
+ - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
+ - context - Context - Required. Parent context.
+*/}}
+{{- define "common.errors.upgrade.passwords.empty" -}}
+ {{- $validationErrors := join "" .validationErrors -}}
+ {{- if and $validationErrors .context.Release.IsUpgrade -}}
+ {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}}
+ {{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}}
+ {{- $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" -}}
+ {{- $errorString = print $errorString "\n%s" -}}
+ {{- printf $errorString $validationErrors | fail -}}
+ {{- end -}}
+{{- end -}}