Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imageupdate automation rewrites a items: [] manifest on a weird location #5064

Open
1 task done
srgvg opened this issue Nov 7, 2024 · 1 comment
Open
1 task done

Comments

@srgvg
Copy link

srgvg commented Nov 7, 2024

Describe the bug

Incidently bumped into this; not sure or just a bug, or partlly a feature.
We got kustomization directory containing amongst others 1 yaml file:

apiVersion: v1
items:
- apiVersion: apps/v1
  kind: Deployment
    (...)
- apiVersion: v1
  kind: Service
    name: web-api
    (...)
kind: List

located at clusters/cosmorak/applications/buut/web-api/webapi.yaml in the git repo
Next to that an imageupdateautomation:

apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImageUpdateAutomation
metadata:
  name: web-api-update-automation
  namespace: flux-system  # The namespace where Flux resources reside
spec:
  interval: 1m0s  # Check every 1 minute for image updates
  sourceRef:
    kind: GitRepository
    name: flux-system  # The name of the GitRepository resource (from kubectl output)
    namespace: flux-system  # The namespace of the GitRepository resource
  git:
    checkout:
      ref:
        branch: main  # The branch of your repository to track ops repo changes
    commit:
      author:
       (...)
     messageTemplate: 'update image to {{range .Updated.Images}}{{println .}}{{end}}'
    push:
      branch: main  # Push changes to the main branch of the ops repo
  update:
    path: ./clusters/cosmorak 
    strategy: Setters  # Automatically update the image tag in your manifest

What then happens, is the weird part: there's a tag to update in the a forementioned deployment, but instead of just updating it in the file clusters/cosmorak/applications/buut/web-api/webapi.yaml, the controller creates two new files at another location:

  • clusters/cosmorak/buut/deployment_web-api.yaml
  • clusters/cosmorak/buut/service_web-api.yaml
    with the respective contents - and the update image tag - for the deployment and the service.
    buut seems to be the name of the namespace - I think/guess.

Steps to reproduce

flux version v2.4.0

Expected behavior

flux updates the original file clusters/cosmorak/buut/service_web-api.yaml and does not create new files on an unexpected location

Screenshots and recordings

No response

OS / Distro

Ubuntu 24.04

Flux version

flux version flux: v2.4.0 distribution: flux-v2.4.0 helm-controller: v1.1.0 image-automation-controller: v0.39.0 image-reflector-controller: v0.33.0 kustomize-controller: v1.4.0 notification-controller: v1.4.0 source-controller: v1.4.1

Flux check

└➞ flux check
► checking prerequisites
✔ Kubernetes 1.30.5+k3s1 >=1.28.0-0
► checking version in cluster
✔ distribution: flux-v2.4.0
✔ bootstrapped: true
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v1.1.0
✔ image-automation-controller: deployment ready
► ghcr.io/fluxcd/image-automation-controller:v0.39.0
✔ image-reflector-controller: deployment ready
► ghcr.io/fluxcd/image-reflector-controller:v0.33.0
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v1.4.0
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v1.4.0
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v1.4.1
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta3
✔ buckets.source.toolkit.fluxcd.io/v1
✔ gitrepositories.source.toolkit.fluxcd.io/v1
✔ helmcharts.source.toolkit.fluxcd.io/v1
✔ helmreleases.helm.toolkit.fluxcd.io/v2
✔ helmrepositories.source.toolkit.fluxcd.io/v1
✔ imagepolicies.image.toolkit.fluxcd.io/v1beta2
✔ imagerepositories.image.toolkit.fluxcd.io/v1beta2
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta2
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta3
✔ receivers.notification.toolkit.fluxcd.io/v1
✔ all checks passed

Git provider

github

Container Registry provider

github

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@makkes
Copy link
Member

makkes commented Nov 11, 2024

You should store your YAML either as a multi-doc file or as several separate files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants