-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
namespace
changes the name of Namespace
resources
#5282
Comments
Hi @lindhe, I see that this is expected behavior from #2867. I'm personally leaning towards preserving the existing behavior because of both its history and my expectations. If I wanted all of my Kubernetes objects to be in the same namespace, I'd want to change my old
This is exactly to your point of the documentation being presently lacking. I agree that we should update the documentation to describe existing behavior. |
Hi! Thanks for the response! I think it's great if we change the documentation first, so let's do that. While I do think that we should change the behavior too, we should probably hold off with that. I think it would have to be considered a breaking change, so maybe something to consider before the next major release. Let me just try and clarify why I think that the behavior should change, so it's documented here for future reference.
I follow your logic here. In my case, it's slightly different though. Since I posted this several months ago, I don't have the details fresh in memory right now. But the gist of my situation is that I use Argo CD to deploy most things in my cluster and I want Argo CD to create a number of namespaces for me. But for all other resources, except the namespaces, I want to ensure that they get deployed to one specific namespace. And that's where I run into issues. I'll get back to you if I can recall the exact circumstances. |
@lindhe I think that also makes sense. Yeah, let us know if you remember your use case! I forgot to mention in my last comment that if you don't want to change the name of
out of the |
I did not know that! Thank you!! 🎉 It sounds like just the thing I needed to work around my case. Awesome. |
FYI: I just rediscovered my original use case! I manage an Argo CD instance where users have their own Argo CD project with a corresponding namespace (User Alice would have an Argo CD What I wanted to do was to include the creation of these projects and namespaces as part of the kustomization I use to deploy Argo CD, so they get deployed automatically alongside Argo CD. But I need to ensure that all Argo CD resources gets scoped to the So now I get back to the question of how to do that… I think I get what you mean by using the customizable namespace transformer and leaving out the element from custom_namespace_transformer.yaml apiVersion: builtin
kind: NamespaceTransformer
metadata:
name: not-important-to-example
namespace: test
setRoleBindingSubjects: none
unsetOnly: true
fieldSpecs: [] kustomization.yaml apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
transformers:
- custom_namespace_transformer.yaml I don't know where to find a full example of using custom transformers… 🤔 |
What happened?
When having multiple
Namespace
resources, settingnamespace
inkustomization.yaml
causes resource collision.What did you expect to happen?
According to the documentation, the
namespace
field "Will override the existing namespace if it is set on a resource, or add it if it is not set on a resource".This makes it sound like it sets
.metadata.namespace
for namespaced resources. That, however, is not all it does. It also changes the.metadata.name
ofNamespace
resources!I expect it to not change the name of my
Namespace
resources. But if that is the intended behavior, I would expect the documentation to be clear about this.How can we reproduce it (as minimally and precisely as possible)?
Expected output
Actual output
Kustomize version
v5.1.0
Operating system
Linux
The text was updated successfully, but these errors were encountered: