@@ -129,13 +129,6 @@ func (c *EngineController) getMergedSubnets(nodeInfo []v1alpha1.NodeInfo) []stri
129
129
subnets := make ([]string , 0 )
130
130
for _ , n := range nodeInfo {
131
131
subnets = append (subnets , n .Subnets ... )
132
- if c .forwardNodeIP {
133
- nodeSubnet := net.IPNet {
134
- IP : net .ParseIP (n .PrivateIP ),
135
- Mask : []byte {0xff , 0xff , 0xff , 0xff },
136
- }
137
- subnets = append (subnets , nodeSubnet .String ())
138
- }
139
132
}
140
133
subnets , _ = cidrman .MergeCIDRs (subnets )
141
134
return subnets
@@ -205,7 +198,20 @@ func (c *EngineController) syncNodeInfo(nodes []v1alpha1.NodeInfo) {
205
198
}
206
199
}
207
200
201
+ func (c * EngineController ) appendNodeIP (gw * v1alpha1.Gateway ) {
202
+ for i := range gw .Status .Nodes {
203
+ nodeSubnet := net.IPNet {
204
+ IP : net .ParseIP (gw .Status .Nodes [i ].PrivateIP ),
205
+ Mask : []byte {0xff , 0xff , 0xff , 0xff },
206
+ }
207
+ gw .Status .Nodes [i ].Subnets = append (gw .Status .Nodes [i ].Subnets , nodeSubnet .String ())
208
+ }
209
+ }
210
+
208
211
func (c * EngineController ) syncGateway (gw * v1alpha1.Gateway ) {
212
+ if c .forwardNodeIP {
213
+ c .appendNodeIP (gw )
214
+ }
209
215
aep := gw .Status .ActiveEndpoint
210
216
subnets := c .getMergedSubnets (gw .Status .Nodes )
211
217
cfg := make (map [string ]string )
0 commit comments