@@ -160,7 +160,7 @@ func (nrc *NetworkRoutingController) Run(healthChan chan<- *healthcheck.Controll
160
160
}
161
161
162
162
klog .V (1 ).Info ("Populating ipsets." )
163
- err = nrc .syncNodeIPSets (nrc . krNode )
163
+ err = nrc .syncNodeIPSets ()
164
164
if err != nil {
165
165
klog .Errorf ("Failed initial ipset setup: %s" , err )
166
166
}
@@ -353,7 +353,7 @@ func (nrc *NetworkRoutingController) Run(healthChan chan<- *healthcheck.Controll
353
353
// Update ipset entries
354
354
if nrc .enablePodEgress || nrc .enableOverlays {
355
355
klog .V (1 ).Info ("Syncing ipsets" )
356
- err = nrc .syncNodeIPSets (nrc . krNode )
356
+ err = nrc .syncNodeIPSets ()
357
357
if err != nil {
358
358
klog .Errorf ("Error synchronizing ipsets: %s" , err .Error ())
359
359
}
@@ -788,7 +788,7 @@ func (nrc *NetworkRoutingController) Cleanup() {
788
788
klog .Infof ("Successfully cleaned the NetworkRoutesController configuration done by kube-router" )
789
789
}
790
790
791
- func (nrc * NetworkRoutingController ) syncNodeIPSets (nodeIPAware utils. NodeIPAware ) error {
791
+ func (nrc * NetworkRoutingController ) syncNodeIPSets () error {
792
792
var err error
793
793
start := time .Now ()
794
794
defer func () {
@@ -810,16 +810,16 @@ func (nrc *NetworkRoutingController) syncNodeIPSets(nodeIPAware utils.NodeIPAwar
810
810
currentPodCidrs := make (map [v1core.IPFamily ][][]string )
811
811
currentNodeIPs := make (map [v1core.IPFamily ][][]string )
812
812
for _ , obj := range nodes {
813
- node := obj .(* v1core.Node )
814
- podCIDRs := getPodCIDRsFromAllNodeSources (node )
813
+ n := obj .(* v1core.Node )
814
+ podCIDRs := getPodCIDRsFromAllNodeSources (n )
815
815
if len (podCIDRs ) < 1 {
816
- klog .Warningf ("Couldn't determine any Pod CIDRs for the %v node, skipping" , node .Name )
816
+ klog .Warningf ("Couldn't determine any Pod CIDRs for the %v node, skipping" , n .Name )
817
817
continue
818
818
}
819
819
for _ , cidr := range podCIDRs {
820
820
ip , _ , err := net .ParseCIDR (cidr )
821
821
if err != nil {
822
- klog .Warningf ("Wasn't able to parse pod CIDR %s for node %s, skipping" , cidr , node .Name )
822
+ klog .Warningf ("Wasn't able to parse pod CIDR %s for node %s, skipping" , cidr , n .Name )
823
823
}
824
824
if ip .To4 () != nil {
825
825
currentPodCidrs [v1core .IPv4Protocol ] = append (currentPodCidrs [v1core .IPv4Protocol ],
@@ -831,10 +831,15 @@ func (nrc *NetworkRoutingController) syncNodeIPSets(nodeIPAware utils.NodeIPAwar
831
831
}
832
832
833
833
var ipv4Addrs , ipv6Addrs [][]string
834
- for _ , nodeIPv4 := range nodeIPAware .GetNodeIPv4Addrs () {
834
+ nrk , err := utils .NewRemoteKRNode (n )
835
+ if err != nil {
836
+ klog .Errorf ("failed to create remote node object for node %s: %v" , n .Name , err )
837
+ continue
838
+ }
839
+ for _ , nodeIPv4 := range nrk .GetNodeIPv4Addrs () {
835
840
ipv4Addrs = append (ipv4Addrs , []string {nodeIPv4 .String (), utils .OptionTimeout , "0" })
836
841
}
837
- for _ , nodeIPv6 := range nodeIPAware .GetNodeIPv6Addrs () {
842
+ for _ , nodeIPv6 := range nrk .GetNodeIPv6Addrs () {
838
843
ipv6Addrs = append (ipv6Addrs , []string {nodeIPv6 .String (), utils .OptionTimeout , "0" })
839
844
}
840
845
currentNodeIPs [v1core .IPv4Protocol ] = append (currentNodeIPs [v1core .IPv4Protocol ], ipv4Addrs ... )
0 commit comments