mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
fix fake remote CRI
This commit is contained in:
parent
d758fc3edb
commit
e8eb5c656b
@ -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
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user