kpt-config-sync
kpt-config-sync copied to clipboard
Make fake.Client more realistic
- 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: 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.
/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.
[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.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/hold
rebasing
Extracted JsonStringer https://github.com/GoogleContainerTools/kpt-config-sync/pull/185
Extract NamespaceConfig dedupe: https://github.com/GoogleContainerTools/kpt-config-sync/pull/186
Extracted CRB fix to https://github.com/GoogleContainerTools/kpt-config-sync/pull/196
Extracted CRD mono-repo changes: https://github.com/GoogleContainerTools/kpt-config-sync/pull/197
/unhold
[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
- ~~OWNERS~~ [haiyanmeng]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/lgtm