]> git.feebdaed.xyz Git - 0xmirror/cilium.git/commitdiff
datapath: read loopback ip from local node
authorMarco Hofstetter <marco.hofstetter@isovalent.com>
Fri, 19 Dec 2025 11:19:53 +0000 (12:19 +0100)
committerMartynas Pumputis <m@lambda.lt>
Fri, 19 Dec 2025 12:57:15 +0000 (12:57 +0000)
This commit changes the construction of the `LocalNodeConfiguration`
to read the service loopback ips from the `localNode` instance rather
than using the global function. This way we can eventually get rid
of the global funcs.

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
pkg/datapath/orchestrator/localnodeconfig.go
pkg/datapath/orchestrator/orchestrator.go

index 95afa68beca2f704763b1e2dac6b9a28ffceb3d0..fb79ec2ef68257906a41dca0e9e58a7da5d90e96 100644 (file)
@@ -7,7 +7,6 @@ import (
        "context"
        "errors"
        "fmt"
-       "log/slog"
 
        "github.com/cilium/statedb"
 
@@ -42,7 +41,6 @@ const (
 // is never mutated in-place.
 func newLocalNodeConfig(
        ctx context.Context,
-       logger *slog.Logger,
        config *option.DaemonConfig,
        localNode node.LocalNode,
        txn statedb.ReadTxn,
@@ -113,8 +111,8 @@ func newLocalNodeConfig(
                AllocCIDRIPv6:                localNode.IPv6AllocCIDR,
                NativeRoutingCIDRIPv4:        datapath.RemoteSNATDstAddrExclusionCIDRv4(localNode),
                NativeRoutingCIDRIPv6:        datapath.RemoteSNATDstAddrExclusionCIDRv6(localNode),
-               ServiceLoopbackIPv4:          node.GetServiceLoopbackIPv4(logger),
-               ServiceLoopbackIPv6:          node.GetServiceLoopbackIPv6(logger),
+               ServiceLoopbackIPv4:          localNode.Local.ServiceLoopbackIPv4,
+               ServiceLoopbackIPv6:          localNode.Local.ServiceLoopbackIPv6,
                Devices:                      nativeDevices,
                NodeAddresses:                statedb.Collect(nodeAddrsIter),
                DirectRoutingDevice:          directRoutingDevice,
index 1739b6680734c60e1c2133ddf7fd9c1518123d48..5543330a8cc79b11d085cf9aa26446836d2a75c6 100644 (file)
@@ -198,7 +198,6 @@ func (o *orchestrator) reconciler(ctx context.Context, health cell.Health) error
        for {
                localNodeConfig, localNodeConfigWatch, err := newLocalNodeConfig(
                        ctx,
-                       o.params.Log,
                        option.Config,
                        localNode,
                        o.params.DB.ReadTxn(),