File tree Expand file tree Collapse file tree 5 files changed +22
-9
lines changed
Expand file tree Collapse file tree 5 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -917,6 +917,9 @@ func encodeNetworkPortStatus(ctx *zedagentContext,
917917 for _ , ipAddr := range port .AddrInfoList {
918918 devicePort .IPAddrs = append (devicePort .IPAddrs , ipAddr .Addr .String ())
919919 }
920+ if port .ClusterIPAddr != nil {
921+ devicePort .IPAddrs = append (devicePort .IPAddrs , port .ClusterIPAddr .String ())
922+ }
920923 // devicePort.Gateway is deprecated - replaced by DefaultRouters
921924 devicePort .DefaultRouters = utils .ToStrings (port .DefaultRouters )
922925 // devicePort.DNSServers is deprecated - replaced by Dns
Original file line number Diff line number Diff line change @@ -211,13 +211,9 @@ func (z *zedkube) updateClusterIPReadiness() (changed bool) {
211211 if port .Logicallabel != z .clusterConfig .ClusterInterface {
212212 continue
213213 }
214- for _ , addr := range port .AddrInfoList {
215- if addr .Addr .Equal (z .clusterConfig .ClusterIPPrefix .IP ) {
216- ready = true
217- break
218- }
219- }
220- if ready {
214+ if port .ClusterIPAddr != nil &&
215+ port .ClusterIPAddr .Equal (z .clusterConfig .ClusterIPPrefix .IP ) {
216+ ready = true
221217 break
222218 }
223219 }
@@ -251,7 +247,6 @@ func (z *zedkube) startClusterStatusServer() {
251247 mux .HandleFunc ("/cluster-app/" , func (w http.ResponseWriter , r * http.Request ) {
252248 z .clusterAppIDHandler (w , r )
253249 })
254-
255250 serverAddr := net .JoinHostPort (
256251 z .clusterConfig .ClusterIPPrefix .IP .String (), types .ClusterStatusPort )
257252 z .statusServer = & http.Server {
Original file line number Diff line number Diff line change @@ -333,7 +333,7 @@ func (z *zedkube) isDeviceInterfaceIP(ipStr string) bool {
333333
334334 // Check each port in deviceNetworkStatus
335335 for _ , port := range z .deviceNetworkStatus .Ports {
336- // Check each address in the port's AddrInfoList
336+ // Check regular addresses, and not include the ClusterIPAddr
337337 for _ , addrInfo := range port .AddrInfoList {
338338 if addrInfo .Addr .Equal (ip ) {
339339 log .Functionf ("Found matching interface IP %s on port %s" , ipStr , port .IfName )
Original file line number Diff line number Diff line change @@ -138,10 +138,12 @@ func (m *DpcManager) updateDNS() {
138138 // Below this point we collect L3-specific info for the port.
139139 if ! port .IsL3Port {
140140 m .deviceNetStatus .Ports [ix ].AddrInfoList = nil
141+ m .deviceNetStatus .Ports [ix ].ClusterIPAddr = nil
141142 continue
142143 }
143144
144145 addrInfoList := make ([]types.AddrInfo , 0 , len (ipAddrs ))
146+ var clusterIPAddr net.IP
145147 if len (ipAddrs ) == 0 {
146148 m .Log .Functionf ("updateDNS: interface %s has NO IP addresses" , port .IfName )
147149 }
@@ -151,9 +153,18 @@ func (m *DpcManager) updateDNS() {
151153 // IP address received over DHCP is ignored.
152154 continue
153155 }
156+ // Cluster IP is kept separate from AddrInfoList — it is only
157+ // for inter-node communication and must not be used as a source
158+ // IP for controller-bound traffic.
159+ if m .clusterStatus .ClusterIPPrefix != nil &&
160+ m .clusterStatus .ClusterIPPrefix .Contains (addr .IP ) {
161+ clusterIPAddr = addr .IP
162+ continue
163+ }
154164 addrInfoList = append (addrInfoList , types.AddrInfo {Addr : addr .IP })
155165 }
156166 m .deviceNetStatus .Ports [ix ].AddrInfoList = addrInfoList
167+ m .deviceNetStatus .Ports [ix ].ClusterIPAddr = clusterIPAddr
157168
158169 // Get DNS etc info from dhcpcd. Updates DomainName and DNSServers.
159170 err = m .getDHCPInfo (& m .deviceNetStatus .Ports [ix ], port )
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ type NetworkPortStatus struct {
5959 DNSServers []net.IP // from DHCP + static combined (with Gateway as fallback)
6060 NtpServers []netutils.HostnameOrIP // from DHCP + static combined
6161 AddrInfoList []AddrInfo // from DHCP + static combined
62+ ClusterIPAddr net.IP // ClusterIPAddr is the cluster IP address assigned to this port
6263 DefaultRouters []net.IP // from DHCP + static combined
6364 Up bool
6465 MacAddr net.HardwareAddr
@@ -262,6 +263,9 @@ func (status DeviceNetworkStatus) MostlyEqual(status2 DeviceNetworkStatus) bool
262263 }) {
263264 return false
264265 }
266+ if ! p1 .ClusterIPAddr .Equal (p2 .ClusterIPAddr ) {
267+ return false
268+ }
265269 if p1 .Up != p2 .Up ||
266270 ! bytes .Equal (p1 .MacAddr , p2 .MacAddr ) {
267271 return false
You can’t perform that action at this time.
0 commit comments