kpt-config-sync icon indicating copy to clipboard operation
kpt-config-sync copied to clipboard

Make fake.Client more realistic

Open karlkfi opened this issue 3 years ago • 8 comments

  • The fake.Client was designed to simulate the apiserver and various upstream controllers in vanilla Kubernetes. This change adds support for simulating the following additional features:
    • Initialize ResourceVersion on Create
    • Increment ResourceVersion on Update/Patch
    • Include a FakeRESTMapper that knows about all the types in the provided Scheme
    • Use the scheme to lookup and populate the GroupVersionKind of any types objects
    • Handle version conversion to store the object as a typed object
    • Apply object defaults from the scheme on Create/Update
    • Handle version conversion when the requested version does not match the stored version (requires scheme to know both versions and the "unversioned" internal version).
    • Add universal support for FieldSelectors
    • Add universal support for LabelSelectors
    • Add universal support for Namespace selectors
    • Add logging for most public functions, to aid unit test debugging.
  • Fix bug in RootSync garbage collection that was causing ClusterRoleBindings not to have subjects removed when more then one RootSync still remained.
  • Improve mono-repo CRD reconciler to use the cluster's preferred CRD version, instead of ssuming v1 is preferred. Then use type conversion to perform more accurate diffs to avoid unnessesary updates.
  • Update all unit tests to expect ResourceVersion from the fake.Client
  • Update the reconciler-manager tests to validate the reconciling status.
  • Update the reconciler-manager tests to fail early after a set of validations happen, rather than continuing to make unrelated changes. This makes them a little easier to debug.

This PR includes many several fixes and enhancements required to add finalizers: https://github.com/GoogleContainerTools/kpt-config-sync/pull/17

karlkfi avatar Sep 01 '22 01:09 karlkfi

@karlkfi: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
kpt-config-sync-presubmit-e2e-mono-repo 5b657fa7c9ebd7c5728aecc9c1c396ceb038cb3e link true /test kpt-config-sync-presubmit-e2e-mono-repo
kpt-config-sync-presubmit-e2e-multi-repo 5b657fa7c9ebd7c5728aecc9c1c396ceb038cb3e link true /test kpt-config-sync-presubmit-e2e-multi-repo

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

google-oss-prow[bot] avatar Sep 01 '22 22:09 google-oss-prow[bot]

/hold

Extracted most of this to https://github.com/GoogleContainerTools/kpt-config-sync/pull/81

Once merged, I'll rebase this one to be just the fake.Client changes.

karlkfi avatar Sep 02 '22 02:09 karlkfi

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please ask for approval from karlkfi by writing /assign @karlkfi in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

google-oss-prow[bot] avatar Oct 04 '22 00:10 google-oss-prow[bot]

/hold

rebasing

karlkfi avatar Oct 04 '22 00:10 karlkfi

Extracted JsonStringer https://github.com/GoogleContainerTools/kpt-config-sync/pull/185

karlkfi avatar Oct 05 '22 00:10 karlkfi

Extract NamespaceConfig dedupe: https://github.com/GoogleContainerTools/kpt-config-sync/pull/186

karlkfi avatar Oct 05 '22 00:10 karlkfi

Extracted CRB fix to https://github.com/GoogleContainerTools/kpt-config-sync/pull/196

karlkfi avatar Oct 05 '22 22:10 karlkfi

Extracted CRD mono-repo changes: https://github.com/GoogleContainerTools/kpt-config-sync/pull/197

karlkfi avatar Oct 05 '22 23:10 karlkfi

/unhold

karlkfi avatar Nov 24 '22 01:11 karlkfi

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haiyanmeng

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

google-oss-prow[bot] avatar Nov 30 '22 14:11 google-oss-prow[bot]

/lgtm

sdowell avatar Nov 30 '22 19:11 sdowell