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

kpt not preserving comment only objects #3941

Open
nduja opened this issue May 4, 2023 · 1 comment
Open

kpt not preserving comment only objects #3941

nduja opened this issue May 4, 2023 · 1 comment
Assignees
Labels
area/hydrate bug Something isn't working

Comments

@nduja
Copy link

nduja commented May 4, 2023

Expected behavior

kpt fn eval preserves all comments in a yam file.

Actual behavior

kpt fn eval removes objects/documents made up of only comments.

Information

kpt version: 1.0.0-beta.31

In our packages we use these "comment only" objects for headers/context for humans and would like to preserve them

Steps to reproduce the behavior

  1. Create a yaml file with an object of entirely comments.
    # Comment only object
    ---
    # Comment in object
    apiVersion: v1
    kind: Namespace
    metadata:
      name: test-ns
    
  2. Run a kpt fn eval function
    kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2.0 --exclude-kind 'Namespace' -- 'by-path=metadata.name' "put-value=test-ns"
  3. Inspect file, "# Comment only object" is removed.
    $ cat ns.yaml 
    # Comment in object
    apiVersion: v1
    kind: Namespace
    metadata:
      name: test-ns
    
@nduja nduja added the bug Something isn't working label May 4, 2023
@natasha41575 natasha41575 added the area/fn-catalog Functions Catalog label May 4, 2023
@yuwenma yuwenma removed the area/fn-catalog Functions Catalog label May 4, 2023
@yuwenma
Copy link
Contributor

yuwenma commented May 4, 2023

I think the problem is not dedicated to a specific function, but how kpt reads/writes and preserves the yaml content during passing them to the KRM functions. @droot do you mind taking a look at this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hydrate bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants