:wave: hello again! Q: What is the recommended pr...
# general
m
👋 hello again! Q: What is the recommended practice to apply a single k8s yaml config file to multiple clusters? Just applying it with multiple cluster providers doesn’t work because the URNs of the sub-resources are not unique. Even if I make the
k8s.yaml.ConfigFile
name unique, its sub-resources will have the same names and conflict. I tried using a
transformation
option that renames the resources (adding a prefix), but that seems to be ignored by pulumi and the URN conflicts persist. I would’ve thought that the object hierarchy would make the URNs unique, but it doesn’t seem to do so. Any ideas?
to be clear, let’s say I have a file named `test.yaml`; it defines resources
foo
and
bar
, and I want to apply it to clusterA and clusterB. even if I do:
Copy code
new k8s.yaml.ConfigFile(
  "clusterA-res",
  { file: "test.yaml" },
  { provider: clusterAProvider }
);
new k8s.yaml.ConfigFile(
  "clusterB-res",
  { file: "test.yaml" },
  { provider: clusterBProvider }
);
pulumi still wants to create two resources named
foo
and two named
bar
, so it fails. Of course, I could create copies of
test.yaml
and rename everything, but that’s obviously undesirable. Using a transformation like this didn’t work either:
Copy code
new k8s.yaml.ConfigFile(
  "clusterA-res",
  { file: "test.yaml" },
  {
    provider: clusterAProvider,
    transformations: [(obj: any) => {
      obj.name = `clusterA-${obj.name}`;
      return obj;
    }],
  }
);
pulumi seems to ignore the renaming