From c19965c740ca06188fe5830fd5cc9f50698c2a3f Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 17 Aug 2017 11:01:05 -0500 Subject: [PATCH] cni: print better error when a CNI .configlist is put into a .config --- pkg/kubelet/network/cni/cni.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/kubelet/network/cni/cni.go b/pkg/kubelet/network/cni/cni.go index d2b1ed873c7..0ae1edc801d 100644 --- a/pkg/kubelet/network/cni/cni.go +++ b/pkg/kubelet/network/cni/cni.go @@ -119,6 +119,13 @@ func getDefaultCNINetwork(pluginDir, binDir, vendorCNIDirPrefix string) (*cniNet glog.Warningf("Error loading CNI config file %s: %v", confFile, err) continue } + // Ensure the config has a "type" so we know what plugin to run. + // Also catches the case where somebody put a conflist into a conf file. + if conf.Network.Type == "" { + glog.Warningf("Error loading CNI config file %s: no 'type'; perhaps this is a .conflist?", confFile) + continue + } + confList, err = libcni.ConfListFromConf(conf) if err != nil { glog.Warningf("Error converting CNI config file %s to list: %v", confFile, err)