mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 12:07:47 +00:00
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
This commit is contained in:
parent
9d6edae63a
commit
ce41faa2eb
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user