https://pulumi.com logo
#kubernetes
Title
# kubernetes
g

gorgeous-lunch-7514

01/08/2024, 4:53 PM
Hey folks, I’m trying to get Pulumi to ignore an image change with a helm chart deployment. I’ve got the following log-line
Apply failed with 1 conflict: conflict with "teleport-kube-agent-updater" using apps/v1: .spec.template.spec.containers[name="teleport"].image
The helm chart code I have is
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: "xxxxx",
      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,
        },
      },
    },
  },
  {
    provider: provider,
    // Use transformation using pulumi.mergeOptions to ignoreChanges to container "teleport" to fix `.spec.template.spec.containers[name="teleport"].image` conflicts
    transformations: [
      (obj: any) => {
        if (
          (obj.type === "kubernetes:apps/v1:Deployment" && obj.props.metadata.name === "teleport-agent-updater") ||
            (obj.type === "kubernetes:apps/v1:StatefulSet" && obj.props.metadata.name === "teleport-agent")) {
          console.log(`Ignoring changes to ${obj.type} ${obj.props.metadata.name}`);
          return {
            props: obj.props,
            opts: pulumi.mergeOptions(obj.opts, { ignoreChanges: ['spec.template.spec.containers[*].image'] }),
          };
        }
        return undefined;
      },
    ],
  }
);
2 Views