k8snetworkplumbingwg / multus-cni

A CNI meta-plugin for multi-homed pods in Kubernetes
Apache License 2.0
2.27k stars 577 forks source link

thin_entrypoint should generate multus kubeconfig with manual option #1295

Open abasitt opened 1 month ago

abasitt commented 1 month ago

Older version of multus e.g. 3.9.3 with older script of thin_entry.sh generates a multus.d directory and multus.kubeconfig file with a non-auto installation e.g. # "--multus-conf-file=/tmp/multus-conf/70-multus.conf"

The new version 4.0.2 with new thin_entrypoint doesn't generate multus.d and multus.kubeconfig if the installation type is non-auto. We still want multus to generate multus.kubeconfig even though if the configfile is used manually.

I believe adding below lines here would fix it. caHash, saTokenHash, err = opt.createKubeConfig(nil, nil) if err != nil { fmt.Fprintf(os.Stderr, "failed to create multus kubeconfig: %v\n", err) return }

dougbtv commented 1 month ago

Any interest in trying a PR for it? I think this is reasonable to expect that functionality in 4.0.

Please add testing to ensure that the kubeconfig generates and what not. Thank you!

abasitt commented 1 month ago

Thank you, will give it a try. :)

abasitt commented 3 weeks ago

@dougbtv I modified the function and did the local testing to make sure it works correctly, but I am struggling to write the unit testing because of the constant here . I wouldn't want to write a dummy file that can mess up with actual tokens in that location. Any suggestions ?.

dougbtv commented 2 weeks ago

Abdul -- not exactly sure what you're asking, mind submitting the change as you have it and we can look at the code? Thanks!