oh maybe it’s because it’s alongside the provider ...
# kubernetes
g
oh maybe it’s because it’s alongside the provider args actually
d
Yes, you need to have it in resource args instead of the opts object
I think you also mutate the object directly instead of returning too
g
yeah, it’s working now but now I’m chasing a phantom I can’t see I want to allow the image updates tbh so ignoring them i don’t mind I can’t see
teleport-kube-agent-updater
when I log the objects in transformations so I assume something else is happening under the hood that I can’t see
Copy code
Apply failed with 1 conflict: conflict with "teleport-kube-agent-updater" using apps/v1: .spec.template.spec.containers[name="teleport"].image
d
It doesn't show at all in transformations, ie with just a transformer that only logs without conditionals?
g
yeah not at all w/o conditionals
d
Oh, 'teleport-kube-agent-updater' will be the name of something already in k8s that manages the image for you. It sounds like a server-side apply conflict
Which suggests the image isn't being ignored by pulumi
Can you post the updated transformations code please
g
give me a mo’
Copy code
const teleport = new k8s.helm.v3.Chart(
  teleportAppName,
  {
    chart: "teleport-kube-agent",
    version: "13.4.14",
    namespace: config.clusterSvcsNamespaceName,
    fetchOpts: {
      repo: "<https://charts.releases.teleport.dev>",
    },
    values: {
      roles: "kube,db",
      authToken: "xxxx",
      proxyAddr: "xxxxx.teleport.sh:443",
      kubeClusterName: config.stackName,
      labels: {
        "teleport.internal/resource-id": "xxxxx",
      },
      enterprise: true,
      updater: {
        enabled: true,
        releaseChannel: "stable/cloud",
      },
      highAvailability: {
        replicaCount: 2,
        podDisruptionBudget: {
          enabled: true,
          minAvailable: 1,
        },
      },
      awsDatabases: [{
        types: ["rds"],
        regions: ["eu-west-2"],
        tags: {
          "*": "*",
        },
      }],
      annotations: {
        serviceAccount: {
          "<http://eks.amazonaws.com/role-arn|eks.amazonaws.com/role-arn>": config.oidcProviderRoleArn,
        },
      },
    },
    transformations: [
      (obj: any) => {
        if (
          (obj.type === "Deployment" && obj.metadata.name === "teleport-agent-updater") ||
            (obj.kind === "StatefulSet" && obj.metadata.name === "teleport-agent")) {
          console.log(`Ignoring changes to ${obj.type} ${obj.metadata.name}`);
          return {
            props: obj.props,
            opts: pulumi.mergeOptions(obj.kind, { ignoreChanges: ['spec.template.spec.containers[*].image'] }),
          };
        }
        console.log(obj);
        return undefined;
      },
    ],
  },
  {
    provider: provider,
    ignoreChanges: ["spec.template.spec.containers[*].image"],
  }
);
the opts arg ignore was just a stab in the dark
d
I think it should be
obj.kind == 'Deployment'
, instead of
.type
g
it’s
type
if I do transformations via the opts arg
d
So
opts
is the second parameter of the transformer, which you modify
g
I’ll wipe my tears and try
d
There's an example in the docs for modifying the alias, which you can follow for modifying `ignoreChanges`: https://www.pulumi.com/registry/packages/kubernetes/api-docs/helm/v3/chart/#chart-with-transformations
g
oh you’re right I have a typo!
also