mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-07-17 09:12:33 +00:00
Fix default case for CNIDir
In case of no-config for CNIDir, multus-cni does not set defaultCNIDir into CNIDir hence multus-cni failed to create container network. This change fixes it.
This commit is contained in:
parent
a78a9241f4
commit
4eeb1fa43f
@ -58,6 +58,10 @@ func loadNetConf(bytes []byte) (*types.NetConf, error) {
|
|||||||
defaultcninetwork = true
|
defaultcninetwork = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if netconf.CNIDir == "" {
|
||||||
|
netconf.CNIDir = defaultCNIDir
|
||||||
|
}
|
||||||
|
|
||||||
if netconf.UseDefault {
|
if netconf.UseDefault {
|
||||||
if netconf.Kubeconfig == "" || !defaultcninetwork {
|
if netconf.Kubeconfig == "" || !defaultcninetwork {
|
||||||
return nil, fmt.Errorf(`If you have set always_use_default, you must also set the delegates & the kubeconfig, refer to the README`)
|
return nil, fmt.Errorf(`If you have set always_use_default, you must also set the delegates & the kubeconfig, refer to the README`)
|
||||||
@ -73,10 +77,6 @@ func loadNetConf(bytes []byte) (*types.NetConf, error) {
|
|||||||
return nil, fmt.Errorf(`delegates or kubeconfig option is must, refer README.md`)
|
return nil, fmt.Errorf(`delegates or kubeconfig option is must, refer README.md`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if netconf.CNIDir == "" {
|
|
||||||
netconf.CNIDir = defaultCNIDir
|
|
||||||
}
|
|
||||||
|
|
||||||
return netconf, nil
|
return netconf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user