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

Retain YAML formatting when using the Git write-back method #501

Open
sa-spag opened this issue Dec 8, 2022 · 2 comments
Open

Retain YAML formatting when using the Git write-back method #501

sa-spag opened this issue Dec 8, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@sa-spag
Copy link

sa-spag commented Dec 8, 2022

Is your feature request related to a problem? Please describe.
When the Image Updater updates a .argocd-source-<appName>.yaml or kustomiztion.yaml file, it does not retain their indentation. For instance, it may generate the following diff:

 apiVersion: kustomize.config.k8s.io/v1beta1
 resources:
-  - some-resource.yaml
+- some-resource.yaml
 images:
...

Describe the solution you'd like
Instead, the Image Updater should retain the existing formatting.

It turns out the issue is pretty common for other projects that edit YAML (see issues linked to kubernetes-sigs/kustomize#3946). Since version 0.11.1, kyaml enables retaining the source file indention (see kubernetes-sigs/kustomize#4043). This feature has been integrated in Flux's Image Automation Controller (see fluxcd/image-automation-controller#366), and I believe we can implement a similar feature for the Image Updater.

Describe alternatives you've considered
None.

Additional context
None.

@sa-spag sa-spag added the enhancement New feature or request label Dec 8, 2022
@nabadger
Copy link

Potentially related: #502

@zagr0
Copy link

zagr0 commented Jun 13, 2024

Would be really great to have the original file content retained, and the only replaced parts are changed.
In our scenario when we write back to git helm values file for new tag, all the values become sorted and reformatted.

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

No branches or pull requests

3 participants