Merge pull request #86724 from gongguan/fix-fake-CRI

fix fake remote CRI
This commit is contained in:
Kubernetes Prow Robot 2020-01-06 18:06:57 -08:00 committed by GitHub
commit 59b4933fb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -61,6 +61,15 @@ func (f *RemoteRuntime) Start(endpoint string) error {
}
go f.server.Serve(l)
// Set runtime and network conditions ready.
f.RuntimeService.FakeStatus = &kubeapi.RuntimeStatus{
Conditions: []*kubeapi.RuntimeCondition{
{Type: kubeapi.RuntimeReady, Status: true},
{Type: kubeapi.NetworkReady, Status: true},
},
}
return nil
}

View File

@ -194,6 +194,14 @@ func (r *FakeRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig,
Network: &runtimeapi.PodSandboxNetworkStatus{
Ip: FakePodSandboxIPs[0],
},
// Without setting sandboxStatus's Linux.Namespaces.Options, kubeGenericRuntimeManager's podSandboxChanged will consider it as network
// namespace changed and always recreate sandbox which causes pod creation failed.
// Ref `sandboxStatus.GetLinux().GetNamespaces().GetOptions().GetNetwork() != networkNamespaceForPod(pod)` in podSandboxChanged function.
Linux: &runtimeapi.LinuxPodSandboxStatus{
Namespaces: &runtimeapi.Namespace{
Options: config.GetLinux().GetSecurityContext().GetNamespaceOptions(),
},
},
Labels: config.Labels,
Annotations: config.Annotations,
RuntimeHandler: runtimeHandler,