From 4eeb1fa43f918d7ee3f367a54ba892c673a2823c Mon Sep 17 00:00:00 2001 From: Tomofumi Hayashi Date: Tue, 8 May 2018 15:24:49 +0900 Subject: [PATCH] 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. --- multus/multus.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/multus/multus.go b/multus/multus.go index d96ead5a7..ecd968ff2 100644 --- a/multus/multus.go +++ b/multus/multus.go @@ -58,6 +58,10 @@ func loadNetConf(bytes []byte) (*types.NetConf, error) { defaultcninetwork = true } + if netconf.CNIDir == "" { + netconf.CNIDir = defaultCNIDir + } + if netconf.UseDefault { 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`) @@ -73,10 +77,6 @@ func loadNetConf(bytes []byte) (*types.NetConf, error) { return nil, fmt.Errorf(`delegates or kubeconfig option is must, refer README.md`) } - if netconf.CNIDir == "" { - netconf.CNIDir = defaultCNIDir - } - return netconf, nil }