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

Chart namespace is applied to non-namespaced objects #731

Open
maybedino opened this issue Sep 6, 2022 · 3 comments
Open

Chart namespace is applied to non-namespaced objects #731

maybedino opened this issue Sep 6, 2022 · 3 comments
Labels
bug Something isn't working effort/small 1 day tops priority/p1 Should be on near term plans

Comments

@maybedino
Copy link

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:

namespace: props.metadata?.namespace ?? this.chart.namespace,

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)

@iliapolo
Copy link
Member

@maybedino Oooh nice! Thanks for this, we'll look into it.

@iliapolo iliapolo added bug Something isn't working effort/small 1 day tops priority/p1 Should be on near term plans labels Sep 14, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot added the closing-soon Issue/PR will be closing soon if no response is provided label Sep 14, 2023
@maybedino
Copy link
Author

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"));

@github-actions github-actions bot removed the closing-soon Issue/PR will be closing soon if no response is provided label Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working effort/small 1 day tops priority/p1 Should be on near term plans
Projects
None yet
Development

No branches or pull requests

2 participants