Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve helm lookup fallback in case of helm template rendering #1897

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ app: "{{ template "harbor.name" . }}"

{{/* Helper for printing values from existing secrets*/}}
{{- define "harbor.secretKeyHelper" -}}
{{- if and (not (empty .data)) (hasKey .data .key) }}
{{- index .data .key | b64dec -}}
{{- if and (not (empty (.data | default dict ))) (hasKey (.data | default dict ) .key) }}
{{- index (.data | default dict ) .key | b64dec -}}
{{- end -}}
{{- end -}}

Expand Down Expand Up @@ -112,8 +112,8 @@ app: "{{ template "harbor.name" . }}"
{{- define "harbor.database.rawPassword" -}}
{{- if eq .Values.database.type "internal" -}}
{{- $existingSecret := lookup "v1" "Secret" .Release.Namespace (include "harbor.database" .) -}}
{{- if and (not (empty $existingSecret)) (hasKey $existingSecret.data "POSTGRES_PASSWORD") -}}
{{- .Values.database.internal.password | default (index $existingSecret.data "POSTGRES_PASSWORD" | b64dec) -}}
{{- if and (not (empty $existingSecret)) (hasKey ($existingSecret.data | default dict) "POSTGRES_PASSWORD") -}}
{{- .Values.database.internal.password | default (index ($existingSecret.data | default dict) "POSTGRES_PASSWORD" | b64dec) -}}
{{- else -}}
{{- .Values.database.internal.password -}}
{{- end -}}
Expand Down