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

Prevent panic when informer receives cache.DeletedFinalStateUnknown #7776

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

Conversation

JoelSpeed
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Makes sure that the cache.DeletedFinalStateUnknown event is handled correctly, when an informer for endpoint slices becomes temporarily disconnected and misses an event.

Updates the logic to correctly type assert and avoid panicking if the event is not as expected.

Which issue(s) this PR fixes:

Fixes #7775

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. release-note-none Denotes a PR that doesn't merit a release note. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 9, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: JoelSpeed
Once this PR has been reviewed and has the lgtm label, please assign feiskyer for approval. 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

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 9, 2024
Copy link

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

nice catch

/lgtm

CC @feiskyer @bridgetkromhout

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 9, 2024
@elmiko
Copy link

elmiko commented Dec 9, 2024

oh, missed the spelling linter lol

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 9, 2024
@elmiko
Copy link

elmiko commented Dec 9, 2024

ok, that looks better ;)

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 9, 2024
@MartinForReal
Copy link
Contributor

/retest

@mboersma
Copy link
Contributor

Is it reasonable to add a unit test for these cases in pkg/provider/azure_local_services_test.go?

@JoelSpeed
Copy link
Contributor Author

Is it reasonable to add a unit test for these cases in pkg/provider/azure_local_services_test.go?

I don't see a way to do this easily. The function that's changed is within the AddEventHandler of the informer, so this is buried quite deep. All of the existing tests use real informers as far as I can tell, so to be able to test this, I'd need to be able to inject the DeletedFinalStateUnknown into the watch stream of the fake client that these are based upon. I see there is a fake watcher and the ability to add a watch reaction to the clientset, but it does not have a way to add a DeletedFinalStateUnknown into the stream. I can test other types (eg send a service object) and make sure there are no panics, but not specifically this one that caused this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic in interface conversion: EndpointSlice informer DeleteEvent event handler func
5 participants