Closed shinebayar-g closed 2 months ago
Our use case is we generate a cdk8s chart per folder by default and set chart props based on folder name.
Actually this works perfectly in our case, but namespace
property is read-only.
Got it working. 😄
chart.apiObjects.forEach((apiObject) => {
if (apiObject.kind === 'StorageClass') {
apiObject.addJsonPatch(JsonPatch.replace('/metadata/namespace', undefined));
}
});
I don't think this should be marked closed, I just ran into the same issue. While it's nice to know that there's a workaround, this should really be considered a bug in cdk8s output generation itself imo.
Just reopened but on second thought, there's no good way for us to know that KubeNamespace
should not be assigned a namespace in this case, but KubePod
should. It requires knowledge about which L1 resources are cluster scoped, which I don't think the schema provides.
This though would be a great fit for cdk8s-plus, where we can manually encode this. Moving to a feature request in cdk8s-plus.
I just found out it's duplicate of https://github.com/cdk8s-team/cdk8s/issues/2170
Description of the bug:
Chart.namespace
shouldn't generate.metadata.namespace
field for cluster level objects such asReproduction Steps:
Given a chart
It generates
while namespace is ignored by kubernetes, it would be nice if cdk8s didn't generate namespace.
Error Log:
Environment:
"cdk8s": "^2.66.9"
,"cdk8s-cli": "^2.133.0"
Other:
This is :bug: Bug Report