Formatting breaks yaml anchors/references
Expected behavior
Formatting configs would not break yaml docs that includes anchors and references.
Actual behavior
Running the kpt fn render command on a configuration that includes anchors and references ends up putting the anchors before the references in the yaml, thereby making the yaml invalid.
Information
Steps to reproduce the behavior
kpt pkg get https://github.com/mortent/kpt-packages.git/zookeeper-networkpolicy
kpt fn render zookeeper-networkpolicy # Succeeds, but reformats the config.
kpt fn render zookeeper-networkpolicy # Fails
I cannot reproduce this because the package uses a private image? How does the output yaml look like?
Simplified the example to avoid relying on the private images.
cc @phanimarupaka @droot
The issue is with format filter ordering of fields. It doesn't consider anchors and references. We should implement additional sorting rules to have anchors before references. What is the priority of this ? m2 or m3 ?
I put this in m4. I don't think using anchors and references are very common with k8s config, so I don't think it is a major issue. But we should keep track of it and see if we can eventually get it fixed.