Fix secret private-registry already exists for Kustomize
Customer on slack has relayed to us that there are some issues with using the Kustomize values when you utilize a create.namespace: false. Generally, there will already be a private-registry secret created within the namespace if it already exists. We need to add in logic in order to not attempt to create a private-registry secret if create.namespace: false and kustomize: true
The relevant code that needs to be edited is here
The potential issue with changing the code is that the assumption is that the namespace already exists before the kustomize occurs instead of being created via helm while at the same time also trying to add in the kustomize.
adding in something along the lines of will work when the assumption is that that the namespace already exists and is deployed before the kustomization, however if both the kustomization and helm/namespace is being created and deployed simultanously it will fail. Investigate some additional methods of accomplishing the task
{{- define "uniqueNamespaces" -}}
{{- $namespaces := list -}}
{{- range $pkg, $vals := .Values.packages -}}
{{- if and (dig "enabled" true $vals) (not (dig "namespace" "create" false (index $.Values.packages $pkg))) -}}
{{- $constraint := $vals -}}
{{- range $key := split "." (default "" $.constraint) -}}
{{- $constraint = (dig $key dict $constraint) -}}
{{- end -}}
{{- if (ternary $constraint (default false $.default) (kindIs "bool" $constraint)) -}}
{{- $namespaces = append $namespaces (dig "namespace" "name" (include "resourceName" $pkg) $vals) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- join " " (uniq $namespaces) | trim -}}
{{- end -}}