-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 error for profile lookups on unmeshed pods with port in default opaque list #11550
Conversation
Signed-off-by: Alex Leong <[email protected]>
Signed-off-by: Alex Leong <[email protected]>
Signed-off-by: Alex Leong <[email protected]>
@@ -55,25 +55,6 @@ func (ept *endpointProfileTranslator) Update(address *watcher.Address) (bool, er | |||
return false, fmt.Errorf("failed to create endpoint: %w", err) | |||
} | |||
|
|||
// The protocol for an endpoint should only be updated if there is a pod, |
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.
All of this protocol hinting logic is already implemented in createWeightedAddr
and the endpoint that we get from createEndpoint
already has the protocol hinting metadata set on it correctly. This code block is redundant.
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 function unit tested? Shouldn't a test break somewhere if so?
Signed-off-by: Alex Leong <[email protected]>
Signed-off-by: Alex Leong <[email protected]>
Signed-off-by: Alex Leong <[email protected]>
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.
👍
controller/api/destination/server.go
Outdated
if err != nil { | ||
log.Errorf("Failed to subscribe to profile by ip %q: %q", dest.GetPath(), err) | ||
return err | ||
} | ||
return nil |
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.
if err != nil { | |
log.Errorf("Failed to subscribe to profile by ip %q: %q", dest.GetPath(), err) | |
return err | |
} | |
return nil | |
if err != nil { | |
log.Errorf("Failed to subscribe to profile by ip %q: %q", dest.GetPath(), err) | |
} | |
return err |
controller/api/destination/server.go
Outdated
if err != nil { | ||
log.Errorf("Failed to subscribe to profile by name %q: %q", dest.GetPath(), err) | ||
return err | ||
} | ||
return nil |
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.
if err != nil { | |
log.Errorf("Failed to subscribe to profile by name %q: %q", dest.GetPath(), err) | |
return err | |
} | |
return nil | |
if err != nil { | |
log.Errorf("Failed to subscribe to profile by name %q: %q", dest.GetPath(), err) | |
} | |
return err |
Signed-off-by: Alex Leong <[email protected]>
Signed-off-by: Alex Leong <[email protected]>
This edge release contains improvements to the logging and diagnostics of the destination controller. * Added a control plane metric to count errors talking to the Kubernetes API ([#11774]) * Fixed an issue causing spurious destination controller error messages for profile lookups on unmeshed pods with port in default opaque list ([#11550]) [#11774]: #11774 [#11550]: #11550 Signed-off-by: Alex Leong <[email protected]>
When we do a
GetProfile
lookup for an unmeshed pod, we set theweightedAddr.ProtocolHint
to an empty value&pb.ProtocolHint{}
to indicate that the address is unmeshed and has no protocol hint. However, when the looked up port is in the default opaque list, we erroneously check ifweightedAddr.ProtocolHint != nil
to determine if we should attempt to get the inbound listen port for that pod. Since&pb.ProtocolHint{} != nil
, we attempt to get the inbound listen port for the unmeshed pod. This results in an error, preventing any validGetProfile
responses from being returned.We update the initialization logic for
weightedAddr.ProtocolHint
to only create a struct when a protocol hint is present and to leave it asnil
if the pod is unmeshed.We add a simple unit test for this behavior as well.