-
Notifications
You must be signed in to change notification settings - Fork 40
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
Remediate watch filter label removal #1328
Remediate watch filter label removal #1328
Conversation
This change handles future cases where watch filtering by label causes delete events when the required label is removed.
1caf605
to
df7767c
Compare
fake.ClusterRoleBindingObject(syncertest.ManagementEnabled), | ||
}, | ||
eventObjs: []client.Object{ | ||
// Watch server treats update to remove required label as a delete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a link to the code? I'm curious about what labels are required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you use label selectors in the watch, it sends a delete event when the selected label is removed.
I asked apimachinery if this was a bug and they said it was working as intended. I haven't gone and tracked down the code for it in the apiserver. It's probably buried in the storage layer.
With our current watches, we don't have any label selectors, so this hasn't been an issues. But for #1301 it's causing two of the conflict e2e tests to fail because they not correctly detecting the label removal, so there's no conflict error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More explanation here: go/config-sync-watch-filter#heading=h.tpnna8sp25vg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a test for similar behavior upstream using a field selector: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/storage/testing/watcher_tests.go#L103
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the "filtering" test immediately after that shows the same behavior for label selectors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nan-yu 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 |
b478dcd
into
GoogleContainerTools:main
This change handles future cases where watch filtering by label causes delete events when the required label is removed.
This blocks watch filtering: #1301