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

Image update automation is modifying the kustomization yaml file format from mutliple line to a single line. #3284

Closed
1 task done
eravindar12 opened this issue Nov 4, 2022 · 7 comments · Fixed by fluxcd/image-automation-controller#605

Comments

@eravindar12
Copy link

eravindar12 commented Nov 4, 2022

Describe the bug

Noticed that the image update automation is modifying the kustmization yaml file format from multi lines to a single line.
due to that reason updating the kustomization yaml file is not in sync with git.

Example:

patches:
- patch**: "- op: replace\n  path: /spec/template/spec/containers/0/volumeMounts\n  value: \n    - mountPath: /usr/share/wildfly/wildfly/standalone/configuration/appConfigMaps/WF\n      name: wf-config\n    - mountPath: /usr/share/wildfly/wildfly/standalone/configuration/appConfigMaps/xxx_config\n      name: sxxx-config\n    - mountPath: /usr/share/wildfly/wildfly/standalone/log\n      name: wildfly-standalone-log\n"**
  target:
    group: apps
    version: v1
    kind: Deployment
    name: sxxxxxxx
- patch: **"- op: replace\n  path: /spec/template/spec/volumes\n  value: \n    - name: sxxl-config\n      configMap:\n        name: sxxxxx-configmaps\n    - name: wf-config\n      configMap:\n        name: sxxxxxxxx-configmaps\n    - name: wildfly-standalone-log\n      emptyDir: {}\n"**
  target:
    group: apps
    version: v1
    kind: Deployment
    name: sxxxxxx
- patch: **"- op: add\n  path: /spec/template/spec/containers/0/env\n  value: \n    - name: SxxxLCONFIG_APP_ENV\n      value: udc\n    - name: SxxxxCONFIG_ORG_TAG\n      value: SxxxxCloudAdminService\n    - name: SxxxxCONFIG_WILDFLY_HEAP_MIN\n      value: 256m\n    - name: SxxxxCONFIG_WILDFLY_HEAP_MAX\n      value: 1024m\n    - name: SxxxCONFIG_WILDFLY_HEAP_MAXMETASPACESIZE\n      value: 256m\n    - name: POD_NAMESPACE\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.namespace\n    - name: POD_NAME\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.name\n"**
  target:
    group: apps
    version: v1
    kind: Deployment
    name: sxxxxxx

Steps to reproduce

N/A

Expected behavior

Expected format should be as below

patches:
  - patch: |
      - op: replace
        path: /spec/template/spec/containers/0/volumeMounts
        value: 
          - mountPath: /usr/share/wildfly/wildfly/standalone/configuration/appConfigMaps/WF
            name: wf-config
          - mountPath: /usr/share/wildfly/wildfly/standalone/configuration/appConfigMaps/xxx_config
            name: xxx-config
          - mountPath: /usr/share/wildfly/wildfly/standalone/log
            name: wildfly-standalone-log
    target:
      group: apps
      version: v1
      kind: Deployment
      name: sxxxxdadminservice
  - patch: |
      - op: replace
        path: /spec/template/spec/volumes
        value: 
          - name:  sxxxx-config
            configMap:
              name: sxxxxx-configmaps
          - name: wf-config
            configMap:
              name: sxxxx-configmaps
          - name: wildfly-standalone-log
            emptyDir: {}
    target:
      group: apps
      version: v1
      kind: Deployment
      name: sxxxxx

  - patch: |
      - op: add
        path: /spec/template/spec/containers/0/env
        value: 
          - name: SxxxxCONFIG_APP_ENV
            value: xxx
          - name: SxxxLCONFIG_ORG_TAG
            value: Sxxxxxx
          - name: SxxxxLCONFIG_WILDFLY_HEAP_MIN
            value: 256m
          - name: SxxxCONFIG_WILDFLY_HEAP_MAX
            value: 1024m
          - name: SxxxxxLCONFIG_WILDFLY_HEAP_MAXMETASPACESIZE
            value: 256m
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: metadata.namespace
          - name: POD_NAME
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: metadata.name
    target:
      group: apps
      version: v1
      kind: Deployment
      name: sxxxxxxx

Screenshots and recordings

No response

OS / Distro

CentOS Linux release 7.7.1908 (Core)

Flux version

flux: v0.35.0
helm-controller: v0.25.0
image-automation-controller: v0.26.0
image-reflector-controller: v0.22.0
kustomize-controller: v0.29.0
notification-controller: v0.27.0
source-controller: v0.30.0

Flux check

flux check
► checking prerequisites
✗ flux 0.35.0 <0.36.0 (new version is available, please upgrade)
✔ Kubernetes 1.22.13-gke.1000 >=1.20.6-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.25.0
✔ image-automation-controller: deployment ready
► ghcr.io/fluxcd/image-automation-controller:v0.26.0
✔ image-reflector-controller: deployment ready
► ghcr.io/fluxcd/image-reflector-controller:v0.22.0
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.29.0
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.27.0
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.30.0
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta1
✔ buckets.source.toolkit.fluxcd.io/v1beta2
✔ gitrepositories.source.toolkit.fluxcd.io/v1beta2
✔ helmcharts.source.toolkit.fluxcd.io/v1beta2
✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1
✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2
✔ imagepolicies.image.toolkit.fluxcd.io/v1beta1
✔ imagerepositories.image.toolkit.fluxcd.io/v1beta1
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta1
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1beta2
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta1
✔ receivers.notification.toolkit.fluxcd.io/v1beta1
✔ all checks passed

Git provider

No response

Container Registry provider

gcr

Additional context

N/A

Code of Conduct

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

jpallas commented Jan 19, 2023

Not just kustomization files, it seems to be doing this to other yaml files too, in particular ConfigMap. It is converting "human-readable" multi-line yaml to very human-unreadable strings with embedded newlines.

@davidhaioum
Copy link

Hello, I have the same issue on the HelmRelease, I tried to put a embedded yaml in the values of the HelmRelease, it format it as a single line string which make the embedded yaml not human-readable

@avielb
Copy link

avielb commented Oct 29, 2023

having the same issue too

@kandreasyan
Copy link

kandreasyan commented Nov 6, 2023

Randomly having the same issue.
Any fix or workaround?

stefanprodan added a commit to fluxcd/image-automation-controller that referenced this issue Nov 21, 2023
@stefanprodan
Copy link
Member

stefanprodan commented Nov 21, 2023

This has been fixed in fluxcd/image-automation-controller#605 and will be included in the Flux v2.2.0 release.

@ruiengana
Copy link

Great news :) @stefanprodan when is 2.2.0 expected to be released? Thank you.

@stefanprodan
Copy link
Member

See #4410

souleb pushed a commit to souleb/image-automation-controller that referenced this issue Mar 12, 2024
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

Successfully merging a pull request may close this issue.

7 participants