mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
[stable/mongodb] Validate 'mongodbDatabase' and 'mongodbUsername' parameters (#15938)
Signed-off-by: juan131 <juan@bitnami.com>
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
7e7dad11dd
commit
badd745ef0
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
name: mongodb
|
||||
version: 6.3.0
|
||||
version: 6.3.1
|
||||
appVersion: 4.0.11
|
||||
description: NoSQL document-oriented database that stores JSON-like documents with dynamic schemas, simplifying the integration of data in content-driven applications.
|
||||
keywords:
|
||||
|
||||
@@ -67,7 +67,7 @@ The following table lists the configurable parameters of the MongoDB chart and t
|
||||
| `usePassword` | Enable password authentication | `true` |
|
||||
| `existingSecret` | Existing secret with MongoDB credentials | `nil` |
|
||||
| `mongodbRootPassword` | MongoDB admin password | `random alphanumeric string (10)` |
|
||||
| `mongodbUsername` | MongoDB custom user | `nil` |
|
||||
| `mongodbUsername` | MongoDB custom user (mandatory if `mongodbDatabase` is set) | `nil` |
|
||||
| `mongodbPassword` | MongoDB custom user password | `random alphanumeric string (10)` |
|
||||
| `mongodbDatabase` | Database to create | `nil` |
|
||||
| `mongodbEnableIPv6` | Switch to enable/disable IPv6 on MongoDB | `false` |
|
||||
|
||||
@@ -65,6 +65,8 @@ To connect to your database from outside the cluster execute the following comma
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- include "mongodb.validateValues" . -}}
|
||||
|
||||
{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||
|
||||
WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
|
||||
|
||||
@@ -163,3 +163,30 @@ Also, we can't use a single if because lazy evaluation is not an option
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Compile all warnings into a single message, and call fail.
|
||||
*/}}
|
||||
{{- define "mongodb.validateValues" -}}
|
||||
{{- $messages := list -}}
|
||||
{{- $messages := append $messages (include "mongodb.validateValues.mongodbCustomDatabase" .) -}}
|
||||
{{- $messages := without $messages "" -}}
|
||||
{{- $message := join "\n" $messages -}}
|
||||
|
||||
{{- if $message -}}
|
||||
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate values of MongoDB - both mongodbUsername and mongodbDatabase are necessary
|
||||
to create a custom user and database during 1st initialization
|
||||
*/}}
|
||||
{{- define "mongodb.validateValues.mongodbCustomDatabase" -}}
|
||||
{{- if or (and .Values.mongodbUsername (not .Values.mongodbDatabase)) (and (not .Values.mongodbUsername) .Values.mongodbDatabase) }}
|
||||
mongodb: mongodbUsername, mongodbDatabase
|
||||
Both mongodbUsername and mongodbDatabase must be provided to create
|
||||
a custom user and database during 1st initialization.
|
||||
Please set both of them (--set mongodbUsername="xxxx",mongodbDatabase="yyyy")
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user