Skip to content

Commit

Permalink
Propagate existing CNI_ARGS to non-k8s consumers, e.g., podman
Browse files Browse the repository at this point in the history
Signed-off-by: Chan Shih-Ping <[email protected]>
  • Loading branch information
space88man committed Feb 20, 2020
1 parent d288157 commit 21dcfcd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/ocicni/ocicni.go
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,13 @@ func buildCNIRuntimeConf(cacheDir string, podNetwork *PodNetwork, ifName string,
CapabilityArgs: map[string]interface{}{},
}

// Propagate existing CNI_ARGS to non-k8s consumers
for _, kvpairs := range strings.Split(os.Getenv("CNI_ARGS"), ";"){
if keyval := strings.Split(kvpairs, "="); len(keyval) == 2 {
rt.Args = append(rt.Args, [2]string{keyval[0], keyval[1]})
}
}

// Add requested static IP to CNI_ARGS
ip := runtimeConfig.IP
if ip != "" {
Expand Down

0 comments on commit 21dcfcd

Please sign in to comment.