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

Preserving comments and other human-readable syntax in output yaml #259

Closed
ahmetb opened this issue Aug 14, 2018 · 2 comments
Closed

Preserving comments and other human-readable syntax in output yaml #259

ahmetb opened this issue Aug 14, 2018 · 2 comments

Comments

@ahmetb
Copy link
Member

ahmetb commented Aug 14, 2018

(I think this is out of scope, but please confirm.)

I'm using kustomize to systemically generate bunch of human readable templates.

So I have patches like:

spec:
  # specify how many replicas you want here
  replicas: 3

that has comments for humans.

I have patches like the following that has syntax making it explicit that it's string, like:

spec:
  loadBalancerIP: "TYPE.YOUR.IP.HERE"

When I do kustomize build:

  • I lose YAML comments
  • I lose the " marks around the strings
  • kustomize "shuffles" the YAML field orders

which makes me think kustomize isn't designed for machine-readable output and not for humans.


I'm opening this issue since I'm not familiar with YAML parsing/patching code of kustomize. If it's more like a GNU patch, I suppose preserving comments could work, but it's more like deserialize/patch/serialize, comments would be lost.

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 14, 2018
@Liujingfang1
Copy link
Contributor

As explained in #261, Kustomize doesn't preserve arbitrary comments. This is out of scope of kustomize, but a perfect feature request similar to go-yaml/yaml#132 in yaml parsing library.
Kustomize is not a template based either. If you just start to set up your application, you can avoid templating by using Kustomize. All the resources should be declarative and able to be piped to kubectl apply -f

@Liujingfang1 Liujingfang1 removed the kind/feature Categorizes issue or PR as related to a new feature. label Aug 14, 2018
@zhouhaibing089
Copy link
Contributor

The issue go-yaml/yaml#132 you mentioned appears to be resolved and supported in yaml.v3 package.

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

4 participants