From 1bde8b36d390d9cadfa65942e389ab503afd7576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Colombaro?= Date: Mon, 9 Sep 2024 17:35:06 +0200 Subject: [PATCH] Use common helper to manage password and report accordingly --- charts/netbox/templates/NOTES.txt | 6 ------ charts/netbox/templates/superuser-secrets.yaml | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/charts/netbox/templates/NOTES.txt b/charts/netbox/templates/NOTES.txt index cc3d1f30..242eb0a0 100644 --- a/charts/netbox/templates/NOTES.txt +++ b/charts/netbox/templates/NOTES.txt @@ -52,9 +52,3 @@ Get the application URL by running these commands: {{- include "common.warnings.rollingTag" .Values.image }} {{- include "common.warnings.rollingTag" .Values.init.image }} {{- include "common.warnings.resources" (dict "sections" (list "" "worker") "context" $) }} -{{- $passwordValidationErrors := list -}} -{{- if not .Values.superuser.existingSecret -}} - {{- $superuserPasswordValidationErrors := include "common.validations.values.single.empty" (dict "valueKey" "superuser.password" "secret" (include "common.secrets.name" (dict "defaultNameSuffix" "superuser" "context" .)) "field" "password" "context" $) -}} - {{- $passwordValidationErrors = append $passwordValidationErrors $superuserPasswordValidationErrors -}} -{{- end }} -{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $) -}} diff --git a/charts/netbox/templates/superuser-secrets.yaml b/charts/netbox/templates/superuser-secrets.yaml index 46474e1a..978c5277 100644 --- a/charts/netbox/templates/superuser-secrets.yaml +++ b/charts/netbox/templates/superuser-secrets.yaml @@ -11,7 +11,7 @@ metadata: type: kubernetes.io/basic-auth data: username: {{ .Values.superuser.name | default "admin" | b64enc | quote }} - password: {{ .Values.superuser.password | default (randAlphaNum 16) | b64enc | quote }} + password: {{ include "common.secrets.passwords.manage" (dict "secret" (include "common.secrets.name" (dict "defaultNameSuffix" "superuser" "context" $)) "key" "password" "providedValues" (list "superuser.password") "context" $) }} email: {{ .Values.superuser.email | b64enc | quote }} api_token: {{ .Values.superuser.apiToken | default uuidv4 | b64enc | quote }} {{- end -}}