<p>I've upgrade from Flux V1 to V2. It all went fairly smooth but I can't seem to get the <code>ImageUpdateAutomation</code> to work. Flux knows I have images to update but it doesn't change the container image in the <code>deployment.yaml</code> manifest and commit the changes to Github. I have no errors in my logs so I'm at a bit of a loss as to what to do next.</p>
<p>I have an file structure that looks something like this:</p>
<pre><code>├── README.md
├── staging
│   ├── api
│   │   ├── deployment.yaml
│   │   ├── automation.yaml
│   │   └── service.yaml
│   ├── app
│   │   ├── deployment.yaml
│   │   ├── automation.yaml
│   │   └── service.yaml
│   ├── flux-system
│   │   ├── gotk-components.yaml
│   │   ├── gotk-sync.yaml
│   │   └── kustomization.yaml
│   ├── image_update_automation.yaml
</code></pre>
<p>My <code>staging/api/automation.yaml</code> is pretty strait-forward:</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageRepository
metadata:
  name: api
  namespace: flux-system
spec:
  image: xxx/api
  interval: 1m0s
  secretRef:
    name: dockerhub

---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImagePolicy
metadata:
  name: api
  namespace: flux-system
spec:
  imageRepositoryRef:
    name: api
  policy:
    semver:
      range: &quot;&gt;=1.0.0&quot;
</code></pre>
<p>My <code>staging/image_update_automation.yaml</code> looks something like this:</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageUpdateAutomation
metadata:
  name: flux-system
  namespace: flux-system
spec:
  git:
    checkout:
      ref:
        branch: master
    commit:
      author:
        email: fluxcdbot@users.noreply.github.com
        name: fluxcdbot
      messageTemplate: '{{range .Updated.Images}}{{println .}}{{end}}'
    push:
      branch: master
  interval: 1m0s
  sourceRef:
    kind: GitRepository
    name: flux-system
  update:
    path: ./staging
    strategy: Setters
</code></pre>
<p>Everything seems to be ok here:</p>
<pre class="lang-sh prettyprint-override"><code>❯ flux get image repository
NAME    READY   MESSAGE                         LAST SCAN                   SUSPENDED
api True    successful scan, found 23 tags  2021-07-28T17:11:02-06:00   False
app True    successful scan, found 18 tags  2021-07-28T17:11:02-06:00   False

❯ flux get image policy
NAME    READY   MESSAGE                                                             LATEST IMAGE
api True    Latest image tag for 'xxx/api' resolved to: 1.0.1   xxx/api:1.0.1
app True    Latest image tag for 'xxx/app' resolved to: 3.2.1   xxx/app:3.2.1
</code></pre>
<p>As you can see from the policy output the <code>LATEST IMAGE</code> api is 1.0.1, however when I view the current version of my app and api they have not been updated.</p>
<pre class="lang-sh prettyprint-override"><code>kubectl get deployment api -n xxx -o json | jq '.spec.template.spec.containers[0].image'
&quot;xxx/api:0.1.5&quot;
</code></pre>
<p>Any advice on this would be much appreciated.</p>

<p>My issue was that I didn't add the comment after my image declaration in my deployment yaml. <a href="https://fluxcd.io/docs/guides/image-update/#configure-image-updates" rel="nofollow noreferrer">More details</a>. Honestly, I'm surprised this is not <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/" rel="nofollow noreferrer">Annotation</a> instead of a comment.</p>
<pre class="lang-yaml prettyprint-override"><code>    spec:
      containers:
        - image: docker.io/xxx/api:0.1.5 # {&quot;$imagepolicy&quot;: &quot;flux-system:api&quot;}

</code></pre>
