image-automation-controller
image-automation-controller copied to clipboard
blank lines removed from kustomization.yaml after image update
Describe the bug
Blank lines are removed from my kustomization.yaml after an image update. In large kustomizations it useful to seperate sections for readability.
To Reproduce
Start with a kustomization.yaml like so:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: production-my-app
namePrefix: production-
commonLabels:
overlay: production
resources:
- namespace.yaml
- ../base
images:
- name: ghcr.io/stefanprodan/podinfo
newTag: 5.0.0 # {"$imagepolicy": "flux-system:my-app-production:tag"}
After an image update, the blank lines are removed :(
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: production-my-app
namePrefix: production-
commonLabels:
overlay: production
resources:
- namespace.yaml
- ../base
images:
- name: ghcr.io/stefanprodan/podinfo
newTag: 5.1.4 # {"$imagepolicy": "flux-system:my-app-production:tag"}
Expected behavior
Maintain the blank lines.
Additional context
flux version 0.9.0
Please see https://github.com/kubernetes-sigs/kustomize/issues/3559
@stefanprodan given the upstream bug on this is now resolved is any work on this planned? We're trying to enforce linters in our gitops repos and many code formatters like yamlfmt
and yamlfix
all prefer indenting lists with an additional two spaces. To be clear I'm happy with either convention, I just can't configure flux or the linters to a single convention - configurability is never a bad thing. Heres what happens in our repos after linting, and then a new image gets commited by flux.
before:
images:
- name: myrepo.azurecr.io/myproject
newName: myrepo.azurecr.io/myproject
newTag: prod-2.2.2 # {"$imagepolicy": "flux-system:myproject:tag"}
after:
images:
- name: myrepo.azurecr.io/myproject
newName: myrepo.azurecr.io/myproject
newTag: prod-2.2.2 # {"$imagepolicy": "flux-system:myproject:tag"}