Skip to content

Handle cluster migrations gracefully in front-proxy - #4219

Merged
kcp-ci-bot merged 5 commits into
kcp-dev:mainfrom
ntnn:watch-through-fp
Sep 11, 2026
Merged

kcp-ci-bot merged 5 commits into
kcp-dev:mainfrom
ntnn:watch-through-fp

Conversation

@ntnn

@ntnn ntnn commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the flake with the pre-migration watch.

What Type of PR Is This?

/kind bug
/kind flake

Related Issue(s)

Fixes #

Release Notes

NONE

@kcp-ci-bot kcp-ci-bot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/flake Categorizes issue or PR as related to a flaky test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 20, 2026
@ntnn
ntnn force-pushed the watch-through-fp branch from cc84c73 to cf366e0 Compare June 20, 2026 21:39
@ntnn

ntnn commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

/retest

@ntnn

ntnn commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

/restart

@ntnn

ntnn commented Jun 21, 2026

Copy link
Copy Markdown
Member Author

/retest

time=2026-06-20T21:50:58.066Z level=ERROR source=manager.go:259 msg="error reloading target set" component="scrape manager" err="invalid config id:kcp-shared-TestUserWithWarrants-1781992249"

@ntnn ntnn mentioned this pull request Jun 22, 2026
// This is only required for watches.
// Lists with a lower RV will get appropriate objects from the shard.
// Lists with a higher RV will get a 504 from the shard.
if index.RecentlyMigrated(result.Cluster) && isInProgressWatch(req) {

@gman0 gman0 Jun 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, what about clients that HAVE done a list before, already know a good RV on the new shard, and want to watch from there on; all while this 90s period is ticking? Maybe the error message could be a bit more helpful, like: ...; watch with resourceVersion temporarily unavailable, or something along those lines.

This could be called a pretty hard nit-picking, but a random user, looking at logs of their client might not know what is going on.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Lists shouldn't be affected, they are just passed through to the shard and as mentioned in the comment they'll either have a lower RV than the new shard, in which case they'll get a diff to the current RV of the new shard.
If they have a higher RV than the new shard the shard will respond with a 504, causing the client to do a relist.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The original implementation also rejected lists but the more I read the code for reflectors the less it made sense to handle lists instead of letting them through^^

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ntnn, what I meant is that the user does List, knows the correct RV, and does a subsequent Watch starting from that point in time.

It's fine for Watch to reject - I don't disagree with that. Just the log msg is hiding the real reason for the rejection and would (at least for me) read as something unrelated being wrong, whereas in fact it's only a temporary thing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I updated the error message, I think its clearer now

Comment thread pkg/index/index_test.go Outdated
Comment on lines +789 to +791
// A watch opened *after* the migration must be live, not stuck in a sticky
// cancelled state. This guards against using a sticky Cancel instead of a
// one-shot Delete, which would permanently kill all watches for the cluster.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Huh? Sounds like the agent had a bit more context than what's in the comment here :P

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

:D Sortof yes, the comments in the original code (from where I copied the context handling) talked about the sticky cancellation and thats what it ran with when building the tests :D

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah but can you pls expand on that thought INSIDE the comment? :D Otherwise nobody knows what that means. Or maybe it's just that I'm uneducated and this is common knowledge?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

True :D Updated with a comment on how the contextmanager handles the context

@mjudeikis mjudeikis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm
/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 13, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 56d5c699a0bd63491663fc41e8642ff28479d112

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 13, 2026
@gman0

gman0 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@mjudeikis were the comments I sent resolved, or the review overall was deemed without merit and it was decided that this can go ahead?

@mjudeikis

Copy link
Copy Markdown
Contributor

@mjudeikis were the comments I sent resolved, or the review overall was deemed without merit and it was decided that this can go ahead?

Sorry, I think I tagged this by mistake while going via all backlist
/approve cancel

@kcp-ci-bot kcp-ci-bot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 13, 2026
@kcp-ci-bot kcp-ci-bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 10, 2026
@mjudeikis

Copy link
Copy Markdown
Contributor

/lgtm
/approve

I need this as its keep flaking in CI

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 10, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: db98c462c4c231f66a6b46f1dd4d8a03abec9d28

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 10, 2026
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
Signed-off-by: Nelo-T. Wallus <n.wallus@sap.com>
Signed-off-by: Nelo-T. Wallus <n.wallus@sap.com>
Signed-off-by: Nelo-T. Wallus <n.wallus@sap.com>
Signed-off-by: Nelo-T. Wallus <n.wallus@sap.com>
Signed-off-by: Nelo-T. Wallus <n.wallus@sap.com>
@kcp-ci-bot kcp-ci-bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 10, 2026
@ntnn
ntnn requested a review from gman0 September 10, 2026 14:05
@ntnn

ntnn commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

/retest

That looks like infra errors?

@mjudeikis

Copy link
Copy Markdown
Contributor

/retest
Ci infra

@kcp-ci-bot

kcp-ci-bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

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

Test name Commit Details Required Rerun command
pull-kcp-test-upgrade a57e5af link false /test pull-kcp-test-upgrade

Full PR test history

Details

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. I understand the commands that are listed here.

@mjudeikis

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 11, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: bfe1a36d6961993c5a02c3d39091175df1a7879b

@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mjudeikis

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

The pull request process is described here

Details 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

@kcp-ci-bot
kcp-ci-bot merged commit 11c2789 into kcp-dev:main Sep 11, 2026
16 of 17 checks passed
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. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/bug Categorizes issue or PR as related to a bug. kind/flake Categorizes issue or PR as related to a flaky test. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants