Pass status along ipam update
Signed-off-by: Lionel Jouin <lionel.jouin@est.tech>
This commit is contained in:

committed by
Casey Callendrello

parent
a4fc6f93c7
commit
fec2d62676
@ -32,3 +32,7 @@ func ExecCheck(plugin string, netconf []byte) error {
|
||||
func ExecDel(plugin string, netconf []byte) error {
|
||||
return invoke.DelegateDel(context.TODO(), plugin, netconf, nil)
|
||||
}
|
||||
|
||||
func ExecStatus(plugin string, netconf []byte) error {
|
||||
return invoke.DelegateStatus(context.TODO(), plugin, netconf, nil)
|
||||
}
|
||||
|
@ -128,6 +128,14 @@ func ConfigureIface(ifName string, res *current.Result) error {
|
||||
route.Scope = netlink.Scope(*r.Scope)
|
||||
}
|
||||
|
||||
if r.Table != nil {
|
||||
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 metric %d (Scope: %v, Table: %d)': %v", r.Dst, gw, ifName, r.Priority, route.Scope, route.Table, err)
|
||||
}
|
||||
|
@ -114,3 +114,12 @@ func CmdDel(cniNetns, cniContainerID, cniIfname string, f func() error) error {
|
||||
func CmdDelWithArgs(args *skel.CmdArgs, f func() error) error {
|
||||
return CmdDel(args.Netns, args.ContainerID, args.IfName, f)
|
||||
}
|
||||
|
||||
func CmdStatus(f func() error) error {
|
||||
os.Setenv("CNI_COMMAND", "STATUS")
|
||||
os.Setenv("CNI_PATH", os.Getenv("PATH"))
|
||||
os.Setenv("CNI_NETNS_OVERRIDE", "1")
|
||||
defer envCleanup()
|
||||
|
||||
return f()
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
// AllSpecVersions contains all CNI spec version numbers
|
||||
var AllSpecVersions = [...]string{"0.1.0", "0.2.0", "0.3.0", "0.3.1", "0.4.0", "1.0.0"}
|
||||
var AllSpecVersions = [...]string{"0.1.0", "0.2.0", "0.3.0", "0.3.1", "0.4.0", "1.0.0", "1.1.0"}
|
||||
|
||||
// SpecVersionHasIPVersion returns true if the given CNI specification version
|
||||
// includes the "version" field in the IP address elements
|
||||
@ -39,6 +39,13 @@ func SpecVersionHasCHECK(ver string) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
// SpecVersionHasSTATUS returns true if the given CNI specification version
|
||||
// supports the STATUS command
|
||||
func SpecVersionHasSTATUS(ver string) bool {
|
||||
ok, _ := version.GreaterThanOrEqualTo(ver, "1.1.0")
|
||||
return ok
|
||||
}
|
||||
|
||||
// SpecVersionHasChaining returns true if the given CNI specification version
|
||||
// supports plugin chaining
|
||||
func SpecVersionHasChaining(ver string) bool {
|
||||
|
Reference in New Issue
Block a user