Switch namespace and patch transformers to kyaml. #2668
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a big (hopefully penultimate) step towards closing #2506 (breaking dependence on apimachinery), which in turn blocks #1500.
This PR is intended to be the only difference between v3.7.0 and v3.8.0.
v3.8.0 has no new features, and no change in the API (compared to v3.7.0), but the output will change. The output may order fields within objects differently. This should have no impact on cluster behavior, and no impact on object-to-object comparisons, but it may cause (text-based) YAML comparison tests to fail.
In v3.8.0, the transformations still (technically) depend on apimachinery, but by default won't use apimachinery code paths - they'll use kyaml instead. That's what can change field order.
If v3.8.0 causes problems for you, switch back to v3.7.0 for now, but please adjust the ordering in your tests. kyaml, not apimachinery, is the intended backing library for yaml manipulation going forward.
There's no global flag to switch back to the old behavior. A global flag could have been introduced, but it would have been impractical. If the flag's default had been to use the old apimachinery code, nobody would have tried the new flag, thus nobody would have tried the new kyaml code. And switching flags in CD scripts is as annoying or more annoying than simply switching back to the 3.7.0 binary.
For those interested, a transformer in the 3.8.0 framework can use the old apimachinery code by using an explicit config containing the line
This option will, however, go away in the next release. If v3.8.0 works as intended, we can start The Big Delete of apimachinery, and switch from ResMap to []*Rnode, and greatly simplify the code base. Also, this will allow a new version of kustomize to be reintroduced to kubectl.