Image Update Automation

How Flux closes the loop from container registry back to Git: image-reflector-controller scans tags, image-automation-controller commits the winning tag into your manifests, and the cluster converges from that commit.

Overview

The gap between CI and Git

Continuous delivery has a gap that plain GitOps does not close. CI builds an image and pushes it to a registry, and then somebody has to change a tag in Git so the cluster picks it up. Teams paper over this with a CI step that runs sed on a YAML file and pushes a commit with a bot token.

That works until the token leaks, the regex eats the wrong line, or two pipelines race each other on the same branch. Flux image update automation is the supported version of that step, run by controllers inside the cluster rather than by a script in a pipeline.

The path runs in one direction. CI pushes a new image tag. An ImageRepository scans the registry's tags, an ImagePolicy picks one of them, and an ImageUpdateAutomation commits that tag to the Git repository and pushes. From there, kustomize-controller or helm-controller applies the change, exactly as it would apply a commit from a person.

> [!IMPORTANT] Automation ends at git push. The image controllers never apply anything to the cluster.

Key concepts

  • ImageRepository
  • ImagePolicy
  • filterTags
  • ImageUpdateAutomation
  • Setter marker
  • Setters strategy
  • push.refspec
  • messageTemplate

Interview questions

  • Walk me through everything that happens between CI pushing an image and the new version running in the cluster, with Flux image automation enabled.
  • Explain the setter marker comment precisely. What are the forms, and what does the namespace refer to?
  • Write an ImagePolicy for tags of the form main-1a2b3c4-1699887766. Why can you not just use semver or plain alphabetical ordering?
  • Why does Flux write the new tag back to Git rather than patching the Deployment directly? How does that compare to argocd-image-updater?
  • How would you set this up safely for production?

Sign up free to read the full topic

More DevOps topics

Start free on Cariara · Coding problems · System design studio