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

Eliminate checking FlagEnableKyamlDefaultValue in tests #3304

Closed
monopole opened this issue Dec 2, 2020 · 4 comments
Closed

Eliminate checking FlagEnableKyamlDefaultValue in tests #3304

monopole opened this issue Dec 2, 2020 · 4 comments
Assignees
Projects

Comments

@monopole
Copy link
Contributor

monopole commented Dec 2, 2020

plugin/builtin/patchstrategicmergetransformer/PatchStrategicMergeTransformer_test.go and other tests have been modified to pass regardless of the value of FlagEnableKyamlDefaultValue, using if statements.

Once all these branches are eliminated, the kyaml and apimachinery code paths provide the same results (with respect to the tests).

This is probably the last blocked for #2506

@Shell32-Natsu
Copy link
Contributor

Great news!

@Shell32-Natsu Shell32-Natsu added this to Under consideration in kanban via automation Dec 2, 2020
monopole added a commit to monopole/kustomize that referenced this issue Dec 5, 2020
This PR
 - defines a patch conflict detector interface,
 - extracts implementations of the interface from the
   merginator code, making the merginator code
   independent of --enable_kyaml.
 - injects those implementations into kustomize
   as a function of --enable_kyaml.

So, instead of using different merginators to combine
resmaps, this pr allows the use of a single patch merge
code path that uses different conflict detectors.

So instead of debating how to merge, we're now only
considering whether to warn on conflict detection
in one transformer.

This PR is in service of kubernetes-sigs#3304, eliminating seven
instances where --enable_kyaml was consulted.  These
were cases where conflict detection wasn't an issue
(but merging patches was).
monopole added a commit to monopole/kustomize that referenced this issue Dec 6, 2020
This PR
 - defines a patch conflict detector interface,
 - extracts implementations of the interface from the
   merginator code, making the merginator code
   independent of --enable_kyaml.
 - injects those implementations into kustomize
   as a function of --enable_kyaml.

So, instead of using different merginators to combine
resmaps, this pr allows the use of a single patch merge
code path that uses different conflict detectors.

So instead of debating how to merge, we're now only
considering whether to warn on conflict detection
in one transformer.

This PR is in service of kubernetes-sigs#3304, eliminating seven
instances where --enable_kyaml was consulted.  These
were cases where conflict detection wasn't an issue
(but merging patches was).
monopole added a commit to monopole/kustomize that referenced this issue Dec 6, 2020
This PR
 - defines a patch conflict detector interface,
 - extracts implementations of the interface from the
   merginator code, making the merginator code
   independent of --enable_kyaml.
 - injects those implementations into kustomize
   as a function of --enable_kyaml.

So, instead of using different merginators to combine
resmaps, this pr allows the use of a single patch merge
code path that uses different conflict detectors.

So instead of debating how to merge, we're now only
considering whether to warn on conflict detection
in one transformer.

This PR is in service of kubernetes-sigs#3304, eliminating seven
instances where --enable_kyaml was consulted.  These
were cases where conflict detection wasn't an issue
(but merging patches was).
monopole added a commit to monopole/kustomize that referenced this issue Dec 6, 2020
This PR
 - defines a patch conflict detector interface,
 - extracts implementations of the interface from the
   merginator code, making the merginator code
   independent of --enable_kyaml.
 - injects those implementations into kustomize
   as a function of --enable_kyaml.

So, instead of using different merginators to combine
resmaps, this pr allows the use of a single patch merge
code path that uses different conflict detectors.

So instead of debating how to merge, we're now only
considering whether to warn on conflict detection
in one transformer.

This PR is in service of kubernetes-sigs#3304, eliminating seven
instances where --enable_kyaml was consulted.  These
were cases where conflict detection wasn't an issue
(but merging patches was).
monopole added a commit to monopole/kustomize that referenced this issue Dec 6, 2020
This PR
 - defines a patch conflict detector interface,
 - extracts implementations of the interface from the
   merginator code, making the merginator code
   independent of --enable_kyaml.
 - injects those implementations into kustomize
   as a function of --enable_kyaml.

So, instead of using different merginators to combine
resmaps, this pr allows the use of a single patch merge
code path that uses different conflict detectors.

So instead of debating how to merge, we're now only
considering whether to warn on conflict detection
in one transformer.

This PR is in service of kubernetes-sigs#3304, eliminating seven
instances where --enable_kyaml was consulted.  These
were cases where conflict detection wasn't an issue
(but merging patches was).
@monopole
Copy link
Contributor Author

To find remaining places needing attention,

find ./ -name "*.go" | xargs grep IfApiMachineryElseKyaml 
find ./ -name "*.go" | xargs grep FlagEnableKyamlDefaultValue 

blocking issue (needs a fix)

issues with workarounds (these only happen with multiple patches at the same level which target the same resource).

  • Patch conflation shouldn't use patching to merge patches
    workaround is don't patch at the same level with multiple distinct patches - instead use an overlay

  • kyaml code paths don't report conflicts in user specified patches; instead last patch wins
    workaround (if desired) same as above if the "last patch wins" result is undesireable.

unclear if desirable or not

  • kyaml and apimachinery code paths have different behavior around quoting (or removing quotes) from bare int and bool
    primitives.

@monopole monopole changed the title Eliminate use of FlagEnableKyamlDefaultValue in PatchStrategicMergeTransformer_test Eliminate checking FlagEnableKyamlDefaultValue in tests Jan 16, 2021
@monopole
Copy link
Contributor Author

monopole commented Jan 17, 2021

Per

clear; find ./ -name "*_test.go" |\
   xargs egrep --before-context=2 "FlagEnableKyamlDefaultValue|IfApiMachinery"

Only remaining open and sorta painful issue is #3394.

I'm in favor of proceeding with #2506 and fixing remaining issues in a pure kyaml world.

@monopole monopole self-assigned this Jan 20, 2021
@monopole
Copy link
Contributor Author

monopole commented Feb 9, 2021

I'm calling this done. All remained branching has been marked as OK, and the k8s.io deps are being removed.

@monopole monopole closed this as completed Feb 9, 2021
kanban automation moved this from Under consideration to Done Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
kanban
  
Done
Development

No branches or pull requests

2 participants