-
Notifications
You must be signed in to change notification settings - Fork 308
Description
Description of the feature or enhancement:
Allow, in addition to a string, passing an object (Namespace/KubeNamespace) as the metadata.namespace when constructing objects (both CDK8s and CDK8s+)
Use Case:
I commonly find myself writing something along the lines of:
const ns = new Namespace(this, "namespace");
new Role(this, "role", {
metadata: {
namespace: ns.name
}
});Proposed Solution:
Allow instead writing:
const ns = new Namespace(this, "namespace");
new Role(this, "role", {
metadata: {
namespace: ns
}
});By changing the type of namespace to string | Namespace | undefined and, on construction, check if it is an object and in that case call .name.
Other:
The code example above is for CDK8s+, but the same concept could also be useful for non-+ (KubeNamespace etc.), at least within each context (objects in CDK8s+ accepting Namespace, Kube*-objects accepting KubeNamespace), but there could also be compatibility between them (allow CDK8s+ objects to accept KubeNamespace, the opposite is likely not feasibly though).
- π I may be able to implement this feature request
-
β οΈ This feature might incur a breaking change
This is a π Feature Request