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

🐛fix(controller): support WaitForSync in custom TypedSyncingSource #3084

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

tareksha
Copy link
Contributor

@tareksha tareksha commented Jan 22, 2025

The code that calls WaitForSync(ctx) checks for the original SyncingSource. This does not work for custom typed controllers where TypedSyncingSource is passed with a type parameter other than reconcile.Request .

this fix should be backported to v0.20 and v0.19

There is already support for defining `TypedSyncingSource` but the original code still checks for the original `SyncingSource` before callign `WaitForSync(ctx)` which does not work for custom typed controller.

this fix should be backported to v0.19
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 22, 2025
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 22, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @tareksha. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 22, 2025
@@ -200,7 +200,7 @@ func (c *Controller[request]) Start(ctx context.Context) error {
sourceStartErrChan <- err
return
}
syncingSource, ok := watch.(source.SyncingSource)
syncingSource, ok := watch.(source.TypedSyncingSource[request])
Copy link
Member

Choose a reason for hiding this comment

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

Oh wow, good catch. Mind adding a tiny test that validates that WaitForSync gets called for a TypedSyncingSource?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@alvaroaleman
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 22, 2025
Copy link

linux-foundation-easycla bot commented Jan 22, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 22, 2025
@tareksha tareksha requested a review from alvaroaleman January 22, 2025 22:37
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 22, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 22, 2025
@alvaroaleman alvaroaleman added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jan 22, 2025
Copy link
Member

@alvaroaleman alvaroaleman left a comment

Choose a reason for hiding this comment

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

Thanks!
/cherrypick release-0.20

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 22, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: f5d3b69cb9e3224d603a42a547efc0c8eaa95d7d

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, tareksha

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 22, 2025
@k8s-ci-robot k8s-ci-robot merged commit 09740a3 into kubernetes-sigs:main Jan 22, 2025
12 checks passed
@alvaroaleman
Copy link
Member

/cherrypick release-0.20

@k8s-infra-cherrypick-robot

@alvaroaleman: new pull request created: #3086

In response to this:

/cherrypick release-0.20

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-sigs/prow repository.

@tareksha
Copy link
Contributor Author

hi @alvaroaleman we need the fix in v0.19 too

@sbueringer
Copy link
Member

/cherrypick release-0.19

@k8s-infra-cherrypick-robot

@sbueringer: #3084 failed to apply on top of branch "release-0.19":

Applying: 🐛fix(controller): use generic WaitForSync
Using index info to reconstruct a base tree...
M	pkg/internal/controller/controller.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/internal/controller/controller.go
CONFLICT (content): Merge conflict in pkg/internal/controller/controller.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 🐛fix(controller): use generic WaitForSync

In response to this:

/cherrypick release-0.19

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-sigs/prow repository.

@sbueringer
Copy link
Member

sbueringer commented Jan 23, 2025

@tareksha Feel free to open a manual cherry-pick PR for release-0.19

tareksha added a commit to tareksha/controller-runtime that referenced this pull request Jan 23, 2025
…ubernetes-sigs#3084)

* 🐛fix(controller): use generic WaitForSync

There is already support for defining `TypedSyncingSource` but the original code still checks for the original `SyncingSource` before callign `WaitForSync(ctx)` which does not work for custom typed controller.

this fix should be backported to v0.19

* test
@tareksha
Copy link
Contributor Author

@tareksha Feel free to open a manual cherry-pick PR for release-0.19

@sbueringer done #3087

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants