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

substituteFrom possible only from same namespace where Kustomization stored #1203

Open
everythings-gonna-be-alright opened this issue Jul 12, 2024 · 4 comments

Comments

@everythings-gonna-be-alright
Copy link

everythings-gonna-be-alright commented Jul 12, 2024

// Name of the values referent. Should reside in the same namespace as the

In my case, the command created Kustomizations in different namespaces.
Such as
monitoring Kustomization -> namespace monitoring
logging Kustomization -> namespace logging
and so on.

How can I share basic variables between all clusters in this case?
Why is it restricted?

.spec.postBuild.substituteFrom[0].namespace: field not declared in schema
@stefanprodan
Copy link
Member

Kubernetes Secrets and ConfigMaps are not meant to be shared across namespaces, it would break RBAC. Use Kyverno or some other tool that can sync them from one namespace to another.

@everythings-gonna-be-alright
Copy link
Author

everythings-gonna-be-alright commented Jul 15, 2024

Oh, I did not know about it. Thanks.
But if it is incorrect, how can I inherit substitutes in child flux customization resources without syncing secrets between namespaces in some other way?

For now, I am forced to declare substitutes for all flux customization:

  postBuild:
    substitute:
      cluster_domain: "${cluster_domain}"

It is not convenient, especially when adding some new variables.
A shared secret is also not an option.
So, only Kyverno?

@stefanprodan
Copy link
Member

stefanprodan commented Jul 15, 2024

See here what cert-manager team recommends https://cert-manager.io/docs/devops-tips/syncing-secrets-across-namespaces/ or do your own search on Google, there are lots of options to sync secrets between namespaces.

@everythings-gonna-be-alright
Copy link
Author

Many thanks. I will try.
One more question.
Wouldn't it be better to implement substitutes inheritance between kustomize.toolkit.fluxcd.io/v1 internally, without the need to create secrets with substitutes?
Why was this approach chosen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants