Skip to content

Commit 87390b5

Browse files
Merge pull request #70 from space88man/parse_cni_args
Propagate existing CNI_ARGS to non-k8s consumers, e.g., podman
2 parents 541cf7c + c0cef6a commit 87390b5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/ocicni/ocicni.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,13 @@ func buildCNIRuntimeConf(podNetwork *PodNetwork, ifName string, runtimeConfig Ru
809809
CapabilityArgs: map[string]interface{}{},
810810
}
811811

812+
// Propagate existing CNI_ARGS to non-k8s consumers
813+
for _, kvpairs := range strings.Split(os.Getenv("CNI_ARGS"), ";"){
814+
if keyval := strings.SplitN(kvpairs, "=", 2); len(keyval) == 2 {
815+
rt.Args = append(rt.Args, [2]string{keyval[0], keyval[1]})
816+
}
817+
}
818+
812819
// Add requested static IP to CNI_ARGS
813820
ip := runtimeConfig.IP
814821
if ip != "" {

0 commit comments

Comments
 (0)