From ce41faa2eb5ac552c8ce9b2d4a585d4b7e93654d Mon Sep 17 00:00:00 2001 From: Ben Moss Date: Thu, 31 Oct 2019 17:51:04 -0400 Subject: [PATCH] Skip GetPodNetworkStatus when CNI not yet initialized Without this scheduling a pod on Windows results in a panic from `addToNetwork` when it tries to read `NetworkConfig` and `CNIConfig` off the nil network --- pkg/kubelet/dockershim/network/cni/cni_windows.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/kubelet/dockershim/network/cni/cni_windows.go b/pkg/kubelet/dockershim/network/cni/cni_windows.go index f3ba62c70de..316d4df9b99 100644 --- a/pkg/kubelet/dockershim/network/cni/cni_windows.go +++ b/pkg/kubelet/dockershim/network/cni/cni_windows.go @@ -45,6 +45,10 @@ func (plugin *cniNetworkPlugin) GetPodNetworkStatus(namespace string, name strin return nil, fmt.Errorf("CNI failed to retrieve network namespace path: %v", err) } + if plugin.getDefaultNetwork() == nil { + return nil, fmt.Errorf("CNI network not yet initialized, skipping pod network status for container %q", id) + } + // Because the default remote runtime request timeout is 4 min,so set slightly less than 240 seconds // Todo get the timeout from parent ctx cniTimeoutCtx, cancelFunc := context.WithTimeout(context.Background(), network.CNITimeoutSec*time.Second)