-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
ambient: fix nil pointer when pod cache is stale #50878
Conversation
8da0621
to
db9c0c9
Compare
I think this logic isn't quite right. will fix it up tomorrow |
I assume you mean |
yes |
@@ -82,12 +82,19 @@ func setupHandlers(ctx context.Context, kubeClient kube.Client, dataplane MeshDa | |||
return s | |||
} | |||
|
|||
// GetPodIfAmbient looks up a pod. It returns: | |||
// * An error if the pod cannot be found | |||
// * nil if the pod is found, but does not have ambient enabled |
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.
Is this just using nil, nil
as a sentinel value? Should we just return a different error value for when the pod is found but isn't configured as we expect?
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 really don't like checking error values personally, its super easy to break accidentally by helpfully wrapping it with more context, etc
I ran into this in an *extremely* bespoke and unsupported environment, but I think it could occur in real world. We are looping outside of GetPodIfAmbient for the pod to show up, but if it fails we panic. We want to instead get an error.
88bbbc1
to
e4a2a19
Compare
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.
TY!
e4a2a19
to
7b7c734
Compare
/retest |
In response to a cherrypick label: new pull request created: #51443 |
I ran into this in an extremely bespoke and unsupported environment,
but I think it could occur in real world. We are looping outside of
GetPodIfAmbient for the pod to show up, but if it fails we panic. We
want to instead get an error.