-
Notifications
You must be signed in to change notification settings - Fork 227
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 fn render
reformats causes undesired field reordering
#2332
Comments
If you look at the yaml lines with comment, the comments are still tied to the same yaml line after the fields reordering.
The comments preservation works as expected. |
kpt fn render
reformats comments into the wrong location.kpt fn render
reformats causes undesired field reordering
Right, they're still tied to the immediately following line. The problem is the whole map being rearranged. |
Here is how formatting works. https://catalog.kpt.dev/format/v0.1/?id=functionconfig This falls into the category of unrecognized fields and are being sorted. I will try to figure out a way to handle this, probably not sort the unrecognized fields and retain their original order. Need to see if there is any downside due to that approach. How big of a problem is it ? If you run render again, the order is not changed correct ? I see the problem with this comment though |
It's not a blocker, but meaningful friction if we're trying to encourage in-place hydration. I'm not aware of any workaround where my goal is preserved (putting the defaultable values at the bottom). |
@phanimarupaka I think this is really something we need to look at. Our users complain about this as well. This behavior is really odd. Kustomizations suddenly look like this: namespace: helix-pomerium
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
metadata:
name: kustomization
annotations:
config.kubernetes.io/local-config: 'true'
resources:
- ../upstream Especially if you have a preexisting base and suddenly, after running the setter function, you got a hundred changes and the comments are all over the place. I agree, it's not as bad if you recreate a package from scratch and the ordering is already there. I think the behavior should be similar to the old kpt set command if that's possible. |
@stefanhenseler This is being actively worked on. Here is the PR for reference. kubernetes-sigs/kustomize#4021 We will include it in the next kpt release. |
Ah ok thanks, I think this will solve it for us. |
The PR to fix this issue has been merged and the fix will be available in beta.2 release of kpt. |
When using
kpt fn render
, comments in my yaml files are arbitrarily relocated and disconnected from their intended location.For example, if I run
kpt fn render
on thisConfigMap
:It will reorganize the entire file and disconnect comments from their intended location:
Desired result: The order of fields in the data map should not be changed and comments should stay connected to the correct lines.
kpt version: v1.0-beta
The text was updated successfully, but these errors were encountered: