Use of Scope for routes in IPAM

Add Scope for routes for cni spec v1.1

Signed-off-by: Lionel Jouin <lionel.jouin@est.tech>
This commit is contained in:
Lionel Jouin
2024-08-30 15:51:32 +02:00
committed by Casey Callendrello
parent 01b3db8e01
commit a6d6efa5ca
2 changed files with 19 additions and 4 deletions

View File

@ -123,8 +123,12 @@ func ConfigureIface(ifName string, res *current.Result) error {
route.Table = *r.Table
}
if r.Scope != nil {
route.Scope = netlink.Scope(*r.Scope)
}
if err = netlink.RouteAddEcmp(&route); err != nil {
return fmt.Errorf("failed to add route '%v via %v dev %v (Table: %d)': %v", r.Dst, gw, ifName, route.Table, err)
return fmt.Errorf("failed to add route '%v via %v dev %v (Scope: %v, Table: %d)': %v", r.Dst, gw, ifName, route.Scope, route.Table, err)
}
}