Skip to content

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

Merged

Conversation

mhofstetter
Copy link
Member

@mhofstetter mhofstetter commented Apr 30, 2025

This PR replaces usages of node.GetInternalIPv4Router() in pkg/proxy with localNode.GetCiliumInternalIP(false) (with the local node retrieved from the injected LocalNodeStore)

Please review the individual commits.

@mhofstetter mhofstetter added kind/cleanup This includes no functional changes. area/proxy Impacts proxy components, including DNS, Kafka, Envoy and/or XDS servers. release-note/misc This PR makes changes that have no direct user impact. labels Apr 30, 2025
@mhofstetter mhofstetter force-pushed the pr/mhofstetter/proxy-use-localnodestore branch from 3cc2f35 to c5e19a9 Compare April 30, 2025 16:50
…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>
@mhofstetter mhofstetter force-pushed the pr/mhofstetter/proxy-use-localnodestore branch from c5e19a9 to 782a90d Compare April 30, 2025 18:50
@mhofstetter
Copy link
Member Author

/test

@mhofstetter mhofstetter marked this pull request as ready for review April 30, 2025 18:50
@mhofstetter mhofstetter requested review from a team as code owners April 30, 2025 18:50
@mhofstetter mhofstetter requested review from sayboras and rgo3 April 30, 2025 18:50
Copy link
Contributor

@rgo3 rgo3 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@sayboras sayboras left a comment

Choose a reason for hiding this comment

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

LGTM ✔️

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 5, 2025
@sayboras sayboras added this pull request to the merge queue May 5, 2025
Merged via the queue into cilium:main with commit c76ceed May 5, 2025
74 checks passed
@mhofstetter mhofstetter deleted the pr/mhofstetter/proxy-use-localnodestore branch May 5, 2025 06:54
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 {
Copy link
Member

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?

Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/proxy Impacts proxy components, including DNS, Kafka, Envoy and/or XDS servers. kind/cleanup This includes no functional changes. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants