@@ -29,6 +29,7 @@ func envCleanup() {
29
29
os .Unsetenv ("CNI_NETNS" )
30
30
os .Unsetenv ("CNI_IFNAME" )
31
31
os .Unsetenv ("CNI_CONTAINERID" )
32
+ os .Unsetenv ("CNI_NETNS_OVERRIDE" )
32
33
}
33
34
34
35
func CmdAdd (cniNetns , cniContainerID , cniIfname string , conf []byte , f func () error ) (types.Result , []byte , error ) {
@@ -37,6 +38,7 @@ func CmdAdd(cniNetns, cniContainerID, cniIfname string, conf []byte, f func() er
37
38
os .Setenv ("CNI_NETNS" , cniNetns )
38
39
os .Setenv ("CNI_IFNAME" , cniIfname )
39
40
os .Setenv ("CNI_CONTAINERID" , cniContainerID )
41
+ os .Setenv ("CNI_NETNS_OVERRIDE" , "1" )
40
42
defer envCleanup ()
41
43
42
44
// Redirect stdout to capture plugin result
@@ -87,6 +89,7 @@ func CmdCheck(cniNetns, cniContainerID, cniIfname string, f func() error) error
87
89
os .Setenv ("CNI_NETNS" , cniNetns )
88
90
os .Setenv ("CNI_IFNAME" , cniIfname )
89
91
os .Setenv ("CNI_CONTAINERID" , cniContainerID )
92
+ os .Setenv ("CNI_NETNS_OVERRIDE" , "1" )
90
93
defer envCleanup ()
91
94
92
95
return f ()
@@ -102,6 +105,7 @@ func CmdDel(cniNetns, cniContainerID, cniIfname string, f func() error) error {
102
105
os .Setenv ("CNI_NETNS" , cniNetns )
103
106
os .Setenv ("CNI_IFNAME" , cniIfname )
104
107
os .Setenv ("CNI_CONTAINERID" , cniContainerID )
108
+ os .Setenv ("CNI_NETNS_OVERRIDE" , "1" )
105
109
defer envCleanup ()
106
110
107
111
return f ()
0 commit comments