@@ -259,42 +259,42 @@ func (k *K8sSWIFTv2Middleware) addRoutes(cidrs []string, gatewayIP string) []cns
259259 return routes
260260}
261261
262- func (k * K8sSWIFTv2Middleware ) SetInfraRoutes () []cns.Route {
262+ func (k * K8sSWIFTv2Middleware ) SetInfraRoutes () ( []cns.Route , error ) {
263263 var routes []cns.Route
264264
265265 // Get and parse infraVNETCIDRs from env
266266 infraVNETCIDRs , err := configuration .InfraVNETCIDRs ()
267267 if err != nil {
268- return errors .Wrapf (err , "failed to get infraVNETCIDRs from env" )
268+ return nil , errors .Wrapf (err , "failed to get infraVNETCIDRs from env" )
269269 }
270270 infraVNETCIDRsv4 , infraVNETCIDRsv6 , err := utils .ParseCIDRs (infraVNETCIDRs )
271271 if err != nil {
272- return errors .Wrapf (err , "failed to parse infraVNETCIDRs" )
272+ return nil , errors .Wrapf (err , "failed to parse infraVNETCIDRs" )
273273 }
274274
275275 // Get and parse podCIDRs from env
276276 podCIDRs , err := configuration .PodCIDRs ()
277277 if err != nil {
278- return errors .Wrapf (err , "failed to get podCIDRs from env" )
278+ return nil , errors .Wrapf (err , "failed to get podCIDRs from env" )
279279 }
280280 podCIDRsV4 , podCIDRv6 , err := utils .ParseCIDRs (podCIDRs )
281281 if err != nil {
282- return errors .Wrapf (err , "failed to parse podCIDRs" )
282+ return nil , errors .Wrapf (err , "failed to parse podCIDRs" )
283283 }
284284
285285 // Get and parse serviceCIDRs from env
286286 serviceCIDRs , err := configuration .ServiceCIDRs ()
287287 if err != nil {
288- return errors .Wrapf (err , "failed to get serviceCIDRs from env" )
288+ return nil , errors .Wrapf (err , "failed to get serviceCIDRs from env" )
289289 }
290290 serviceCIDRsV4 , serviceCIDRsV6 , err := utils .ParseCIDRs (serviceCIDRs )
291291 if err != nil {
292- return errors .Wrapf (err , "failed to parse serviceCIDRs" )
292+ return nil , errors .Wrapf (err , "failed to parse serviceCIDRs" )
293293 }
294294
295295 ip , err := netip .ParseAddr (podIPInfo .PodIPConfig .IPAddress )
296296 if err != nil {
297- return errors .Wrapf (err , "failed to parse podIPConfig IP address %s" , podIPInfo .PodIPConfig .IPAddress )
297+ return nil , errors .Wrapf (err , "failed to parse podIPConfig IP address %s" , podIPInfo .PodIPConfig .IPAddress )
298298 }
299299
300300 if ip .Is4 () {
@@ -307,5 +307,5 @@ func (k *K8sSWIFTv2Middleware) SetInfraRoutes() []cns.Route {
307307 routes = append (routes , k .addRoutes (infraVNETCIDRsv6 , overlayGatewayV6 )... )
308308 }
309309
310- return routes
310+ return routes , nil
311311}
0 commit comments