-
Notifications
You must be signed in to change notification settings - Fork 3.4k
proxy: use LocalNodeStore to retrieve local node #39268
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
proxy: use LocalNodeStore to retrieve local node #39268
Conversation
3cc2f35
to
c5e19a9
Compare
…status Currently, resolving the proxy IP for the proxy status uses `node.GetInternalIPv4Router` which uses a global variable that stores the local node. It's preferred that the local node should be retrieved via `LocalNodeStore` instead. Therefore, this commit refactors the proxy status accordingly. Note: fetching the proxy ip is best-effort, as the status collection will periodically try to resolve the status. (unfortunately it also doesn't pass a proper `context.Context` - therefore using a new background context with a timeout for the time being. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
…ules This commit uses the localnodestore to retrieve the localnode in the function `ReinstallRoutingRules` instead of using the global functions that use the stored local node from the global field. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
c5e19a9
to
782a90d
Compare
/test |
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
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 ✔️
if err := installFromProxyRoutesIPv4(logger, node.GetInternalIPv4Router(), defaults.HostDevice, fromIngressProxy, fromEgressProxy, mtu); err != nil { | ||
if err := installFromProxyRoutesIPv4(logger, localNode.GetCiliumInternalIP(false), defaults.HostDevice, fromIngressProxy, fromEgressProxy, mtu); err != 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.
@mhofstetter 👋 did you look at the corresponding change for the IPv6 path, so that we can also get rid of the getCiliumNetIPv6()
uglyness?
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.
No I didn't. But it looks like we're using the v4 IP from cilium_host
(CiliumInternalIPv4 on the local node object) whereas we're using the first IPv6 from cilium_net
- that isn't accessible from the local node object).
Is there a specific reason why we handle this differently for IPv6? Or can we just change this (and use the CiliumInternalIPv6) and get rid of getCiliumNetIPv6
completely? (happy to open that PR if we can agree on the change)
cc @rgo3 - maybe you can provide some additional context as well
This PR replaces usages of
node.GetInternalIPv4Router()
inpkg/proxy
withlocalNode.GetCiliumInternalIP(false)
(with the local node retrieved from the injectedLocalNodeStore
)Please review the individual commits.