kubernetes-retired / rktlet

[EOL] The rkt implementation of the Kubernetes Container Runtime Interface
Apache License 2.0
137 stars 43 forks source link

rktlet/runtime: wait until the PodSandbox's state became NOTREADY #142

Closed dongsupark closed 7 years ago

dongsupark commented 7 years ago

There was a race between StopPodSandbox() between PodSandboxStatus(), Even when StopPodSandbox() successfully stopped the PodSandbox, PodSandboxStatus() could still return the state READY. It should be actually NOTREADY. That's so especially when a client calls PodSandboxStatus() too fast.

So just like done in RunPodSanbox(), StopPodSandbox() should also wait for a while, up to 10 seconds, until the correct state was set. For that, let's create a common helper waitPodSandboxStatus() which can be called by both Run and Stop.

Fixes https://github.com/kubernetes-incubator/rktlet/issues/141

dongsupark commented 7 years ago

Fixed another bug in this PR. Unlike StopPodSandbox, RunPodSandbox needs to take care of rktUUID instead of id. Otherwise PodSandbox doesn't run at all.