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 secret private-registry already exists for Kustomize #90

Open
p1-bot-repo-sync bot opened this issue Jan 23, 2025 · 0 comments
Open

Fix secret private-registry already exists for Kustomize #90

p1-bot-repo-sync bot opened this issue Jan 23, 2025 · 0 comments

Comments

@p1-bot-repo-sync
Copy link

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 -}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

0 participants