https://pulumi.com logo
a

able-painter-57976

09/11/2023, 8:58 AM
Hi, I'd like to ask how do you solve deploying k8s deployment with image tagged
latest
. I've got running deployment and newer image, but for pulumi there is no change? How to "redeploy" deployment to download latest latest image.
f

full-eve-52536

09/11/2023, 1:24 PM
That doesn't sound right to me. Could it be that your kubernetes yaml files are not set up right? Possibly the `imagePullPolicy` config?
a

able-painter-57976

09/11/2023, 1:42 PM
Hi,
imagePullPolicy
is ok. I use
Always
but common problem for deploying something with
latest
tag is that k8s does not recognize the change as manifests are the same. My question may state if pulumi has something to solve this issue, but as I think about it can't as this is based on k8s structure and declarative definitions in manifests.
Basically it's recommended not to use
latest
f

full-boots-69133

09/12/2023, 1:05 AM
Depending on if you can query your registry from Pulumi you could do something like this (using AWS ECR):
Copy code
const imageDetails = aws.ecr.getImageOutput({
  imageTag: 'latest',
  repositoryName: 'company-name/my-service',
})

const image = pulumi.interpolate`${imageDetails.repositoryName}@sha256:${imageDetails.imageDigest}}`
assuming
imageDetails.imageDigest
does not include the
sha256:
suffix (I have not tested this). I have used this approach with Ansible + Cloudformation (with ECS) in the past and it worked well.