@@ -250,7 +250,29 @@ func (k *K8sSWIFTv2Middleware) Type() cns.SWIFTV2Mode {
250250 return cns .K8sSWIFTV2
251251}
252252
253- // CNS gets node, pod and service CIDRs from configuration env and parse them to get the v4 and v6 IPs
253+ // CNS gets pod CIDRs from configuration env and parse them to get the v4 and v6 IPs
254+ // Containerd reassigns the IP to the adapter and kernel configures the pod cidr route by default, so windows swiftv2 does not require pod cidr
255+ func (k * K8sSWIFTv2Middleware ) GetPodCidrs () (v4IPs , v6IPs []string , err error ) {
256+ v4IPs = []string {}
257+ v6IPs = []string {}
258+
259+ // Get and parse podCIDRs from env
260+ podCIDRs , err := configuration .PodCIDRs ()
261+ if err != nil {
262+ return nil , nil , errors .Wrapf (err , "failed to get podCIDRs from env" )
263+ }
264+ podCIDRsV4 , podCIDRv6 , err := utils .ParseCIDRs (podCIDRs )
265+ if err != nil {
266+ return nil , nil , errors .Wrapf (err , "failed to parse podCIDRs" )
267+ }
268+
269+ v4IPs = append (v4IPs , podCIDRsV4 ... )
270+ v6IPs = append (v6IPs , podCIDRv6 ... )
271+
272+ return v4IPs , v6IPs , nil
273+ }
274+
275+ // CNS gets node and service CIDRs from configuration env and parse them to get the v4 and v6 IPs
254276func (k * K8sSWIFTv2Middleware ) GetCidrs () (v4IPs , v6IPs []string , err error ) {
255277 v4IPs = []string {}
256278 v6IPs = []string {}
@@ -265,16 +287,6 @@ func (k *K8sSWIFTv2Middleware) GetCidrs() (v4IPs, v6IPs []string, err error) {
265287 return nil , nil , errors .Wrapf (err , "failed to parse infraVNETCIDRs" )
266288 }
267289
268- // Get and parse podCIDRs from env
269- podCIDRs , err := configuration .PodCIDRs ()
270- if err != nil {
271- return nil , nil , errors .Wrapf (err , "failed to get podCIDRs from env" )
272- }
273- podCIDRsV4 , podCIDRv6 , err := utils .ParseCIDRs (podCIDRs )
274- if err != nil {
275- return nil , nil , errors .Wrapf (err , "failed to parse podCIDRs" )
276- }
277-
278290 // Get and parse serviceCIDRs from env
279291 serviceCIDRs , err := configuration .ServiceCIDRs ()
280292 if err != nil {
@@ -286,11 +298,9 @@ func (k *K8sSWIFTv2Middleware) GetCidrs() (v4IPs, v6IPs []string, err error) {
286298 }
287299
288300 v4IPs = append (v4IPs , infraVNETCIDRsv4 ... )
289- v4IPs = append (v4IPs , podCIDRsV4 ... )
290301 v4IPs = append (v4IPs , serviceCIDRsV4 ... )
291302
292303 v6IPs = append (v6IPs , infraVNETCIDRsv6 ... )
293- v6IPs = append (v6IPs , podCIDRv6 ... )
294304 v6IPs = append (v6IPs , serviceCIDRsV6 ... )
295305
296306 return v4IPs , v6IPs , nil
0 commit comments