-
Notifications
You must be signed in to change notification settings - Fork 294
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
Chart namespace is applied to non-namespaced objects #2170
Comments
@maybedino Oooh nice! Thanks for this, we'll look into it. |
This issue has not received any attention in 1 year and will be closed soon. If you want to keep it open, please leave a comment below @mentioning a maintainer. |
This does not really cause any issues unless you have to validate your YAML files. The Kubernetes API does not complain. @iliapolo Maybe it would still be good to keep this open, since technically it creates invalid YAML files which can cause problems with some deployment tools. Our current workaround is to do this: const ns = new k8s.KubeNamespace(this, "FooBar", {
metadata: { name: "FooBar" },
});
ns.addJsonPatch(JsonPatch.remove("/metadata/namespace")); |
Workaround that I used in cdk8s-team/cdk8s-plus#4239 (comment) requires me to update the if condition whenever we introduce a new cdk8s imported class which can be error prone. I guess something like |
Really would love to see this issue fixed natively. |
Currently, if you set a namespace for a chart, it will set the namespace on every object in the chart that does not have one:
https://github.com/cdk8s-team/cdk8s-core/blob/ab3fbf376841dd37cbfb53201fd1c8169bac16ae/src/api-object.ts#L133
While every Kubernetes object can have a metadata.namespace, some are cluster objects that are not namespaced. Applying a namespace to a cluster object breaks tools that check for this, like Terraform (I was trying to deploy with cdktf-cdk8s)
The text was updated successfully, but these errors were encountered: