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

docs: Update workflow for resource migration with reconciler annotation #2860

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jasonvigil
Copy link
Collaborator

This is the first step in removing KCC_USE_DIRECT_RECONCILERS, and switching over to using the user-configurable annotation instead.

This lets us simultaneously test/review the behavior of legacy TF/DCL-based controllers and the new direct controllers.

Copy link
Contributor

[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 jasonvigil. 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

Copy link
Collaborator

@acpana acpana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small comments but overall looks great, thanks for making these changes 🙏🏼

Comment on lines 44 to 45
Copy all existing test cases and add `-direct` suffix to the test names.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's offer an example maybe of what the final folder will look like here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, added an example


This will override the `cnrm.cloud.google.com/dcl2crd: "true"` or `cnrm.cloud.google.com/tf2crd: "true"` annotations in the CRD and enable the direct controller for the new test cases. The previously-existing test cases will continue to use the TF/DCL-based controller.

Verify the new `-direct` test cases have equivalent behavior to the existing test cases (though not necessarily the exact same API interactions, if the direct controller achieves the same end result differently than the TF/DCL-based controller).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an external contributor, how do I verify this 🙃 ? Would it be sufficient for now that the new tests pass?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I feel like it's impossible to expect external contributers to develop new controllers with only mock tests. They will need to verify behavior with real gcp, using hack/record-gcp.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about suggesting users to use git mv when creating the -direct test cases. So that the PR git-diff shows whether it gives equivalent behavior or not.

* The roundtrip fuzz tests shall cover all the fields in `spec `and `status.observedState `fields [example](https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/0bbac86ace6ab2f4051b574f026d5fe47fa05b75/pkg/controller/direct/redis/cluster/roundtrip_test.go#L92)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The roundtrip fuzz tests shall cover all the fields in `spec `and `status.observedState `fields [example](https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/0bbac86ace6ab2f4051b574f026d5fe47fa05b75/pkg/controller/direct/redis/cluster/roundtrip_test.go#L92)
* The roundtrip fuzz tests covers all the fields in `spec `and `status.observedState `fields [example](https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/0bbac86ace6ab2f4051b574f026d5fe47fa05b75/pkg/controller/direct/redis/cluster/roundtrip_test.go#L92)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems totally unrelated, no? Created #2866.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this change about? I apply RFC2119 on the wordings for should and shall here.

This is the first step in removing KCC_USE_DIRECT_RECONCILERS, and
switching over to using the user-configurable annotation instead.

This lets us simultaneously test/review the behavior of legacy
TF/DCL-based controllers and the new direct controllers.
@jasonvigil jasonvigil force-pushed the remove-KCC_USE_DIRECT_RECONCILERS branch from 9a860fd to 4c5d00b Compare October 7, 2024 18:06
@jasonvigil jasonvigil requested a review from acpana October 7, 2024 18:06
### For DCL-based Beta resource

* Remove the `cnrm.cloud.google.com/dcl2crd: "true"` label from the CRD will turn on SciFi controller.
* Remove all of the duplicate `-direct` mockgcp test cases, and re-record mockgcp interactions (now using direct controller instead of legacy TF/DCL).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to make it clear that the transient -direct test cases are only required for Beta TF/DCL migration


### For TF-based Beta resource
* Remove the `cnrm.cloud.google.com/dcl2crd: "true"` or `cnrm.cloud.google.com/tf2crd: "true"` go tag from the CRD struct, and run `dev/tasks/generate-crds` to use Direct as the permanent controller.
Copy link
Collaborator

@yuwenma yuwenma Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the wording changes, can we also keep the example? Otherwise it could be hard for contributors to figure out what the CRD struct or API refers to.

@@ -1,14 +1,10 @@
# 5. Release

## 5.1 Turn on your Direct controller (TF/DCL Beta Only)
## 5.1 Make Direct controller the default (for migration from TF/DCL)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to keep the Beta only because Alpha TF/DCL migration does not require changing the tf2crd or dcl2crd labels.

### PR Reviews

* We require the roundtrip fuzz tests to cover all the fields in `spec` and `status.observedState` fields [example](https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/0bbac86ace6ab2f4051b574f026d5fe47fa05b75/pkg/controller/direct/redis/cluster/roundtrip_test.go#L92) (For mapper)
* We require removing the `cnrm.cloud.google.com/dcl2crd: "true"` or `cnrm.cloud.google.com/tf2crd: "true"` tags from the API and the presubmit test passes.
* We require duplicating all existing test cases (by copying and adding `-direct` suffix to test names), and enabling the direct controller in the new test cases (by setting the `alpha.cnrm.cloud.google.com/reconciler: direct` annotation).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest giving more detailed guidance so we can verify this, like "using git mv to ..."


This will override the `cnrm.cloud.google.com/dcl2crd: "true"` or `cnrm.cloud.google.com/tf2crd: "true"` annotations in the CRD and enable the direct controller for the new test cases. The previously-existing test cases will continue to use the TF/DCL-based controller.

Verify the new `-direct` test cases have equivalent behavior to the existing test cases (though not necessarily the exact same API interactions, if the direct controller achieves the same end result differently than the TF/DCL-based controller).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about suggesting users to use git mv when creating the -direct test cases. So that the PR git-diff shows whether it gives equivalent behavior or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants