Hello, we are using ConfigGroup with namespace tr...
# kubernetes
c
Hello, we are using ConfigGroup with namespace transformation. When we try
pulumi preview
, we will see previous namespace in name. It's bug or wanted behavior? Situation:
Copy code
export function initPrometheusService(namespace: string) {
    new k8s.yaml.ConfigGroup(
        "prometheus-service-deploy",
        {
            files: [
                join(getPath(), "tinky-winky.yaml"),
                join(getPath(), "dipsy.yaml"),
                join(getPath(), "laa-laa.yaml"),
                join(getPath(), "po.yaml")
            ]
        },
        {
            parent: aks,
            transformations: [
                (obj: any) => {
                    const metadata = obj.props?.metadata;
                    if (!metadata) {
                        return;
                    }
                    metadata.namespace = "evils";
                    return obj;
                }
            ]
        }
    );
}
When previous namespace is telletubies and I want new namespace as evils. I will see name, which namespace as before transformation, (telletubies/RESOURCE_NAME) in preview (or pulumi up - preview part).
g
I would expect you to see something along these lines during preview
It may be a problem with your transformation. I’m not sure
obj.props?.metadata
is correct; I’d expect it to be
obj.metadata
.
Note that instead of changing the namespace with a transformation, you can set a default namespace on a Provider, and any resources using that Provider will use that namespace if one is not already set.
Copy code
const provider = new k8s.Provider("bar", {namespace: "bar"});

new k8s.yaml.ConfigFile("test",
    {file: "secret.yaml"},
    {provider}
);
c
@gorgeous-egg-16927 I see create BEFORE_TRANSFORMATION_NS/secret name during preview. After
pulumi up
in kubectl is used correct (after transformation) namespace. I tried add console.log in transformation function and it shown log info correctly. Provider default namespace is not right way for us.