kubernetes/pkg
Clayton Coleman 3eadd1a9ea
Keep pod worker running until pod is truly complete
A number of race conditions exist when pods are terminated early in
their lifecycle because components in the kubelet need to know "no
running containers" or "containers can't be started from now on" but
were relying on outdated state.

Only the pod worker knows whether containers are being started for
a given pod, which is required to know when a pod is "terminated"
(no running containers, none coming). Move that responsibility and
podKiller function into the pod workers, and have everything that
was killing the pod go into the UpdatePod loop. Split syncPod into
three phases - setup, terminate containers, and cleanup pod - and
have transitions between those methods be visible to other
components. After this change, to kill a pod you tell the pod worker
to UpdatePod({UpdateType: SyncPodKill, Pod: pod}).

Several places in the kubelet were incorrect about whether they
were handling terminating (should stop running, might have
containers) or terminated (no running containers) pods. The pod worker
exposes methods that allow other loops to know when to set up or tear
down resources based on the state of the pod - these methods remove
the possibility of race conditions by ensuring a single component is
responsible for knowing each pod's allowed state and other components
simply delegate to checking whether they are in the window by UID.

Removing containers now no longer blocks final pod deletion in the
API server and are handled as background cleanup. Node shutdown
no longer marks pods as failed as they can be restarted in the
next step.

See https://docs.google.com/document/d/1Pic5TPntdJnYfIpBeZndDelM-AbS4FN9H2GTLFhoJ04/edit# for details
2021-07-06 15:55:22 -04:00
..
api Merge pull request #101294 from twosigma/gasethostnamefqdn 2021-06-09 09:07:48 -07:00
apis Update helper methods to print and parse ReadWriteOncePod access mode 2021-06-28 21:25:37 -07:00
auth Update auth OWNERS files to only use aliases 2021-04-07 10:46:03 -04:00
capabilities initialize capabilities unit test 2021-03-13 10:53:47 +01:00
client Prune stale entries from OWNERS files 2021-04-13 20:54:50 -04:00
cloudprovider Prune stale entries from OWNERS files 2021-04-13 20:54:50 -04:00
cluster/ports refactor: disable insecure serving in controller-manager 2021-05-03 00:01:49 +08:00
controller Rename access mode contains helper method 2021-06-28 21:24:56 -07:00
controlplane remove the ssh tunneler implementation from kube-apiserver 2021-06-03 14:30:14 -04:00
credentialprovider Merge pull request #100686 from hasheddan/azure-credential-client 2021-04-21 01:10:11 -07:00
features ReadWriteOncePod PV access mode and feature gate 2021-06-28 21:25:35 -07:00
fieldpath hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
generated remove go-openapi/spec 2021-04-21 11:31:49 +02:00
kubeapiserver PodSecurity: kube-apiserver: admission wiring 2021-06-28 17:45:35 -04:00
kubectl hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
kubelet Keep pod worker running until pod is truly complete 2021-07-06 15:55:22 -04:00
kubemark Add scalability label to kubemark OWNERS 2021-06-03 11:03:04 -07:00
printers CSIServiceAccountToken ga 2021-06-21 11:35:24 -07:00
probe Fix test order in /pkg/probe/http/http_test.go 2021-06-05 07:27:34 +00:00
proxy Merge pull request #103138 from sbangari/winDsrLoadBalancerServiceFix 2021-06-28 23:26:51 -07:00
quota/v1 Fixed several spelling mistakes 2021-03-30 23:02:09 +02:00
registry Add validation options for PersistentVolumeClaims 2021-06-28 21:24:55 -07:00
routes hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
scheduler Merge pull request #103133 from marwanad/allow-scheduler-to-patch-conditions 2021-06-28 12:46:28 -07:00
security BoundServiceAccountTokenVolume ga 2021-05-13 20:45:47 -07:00
securitycontext Kubelet updates for Windows HostProcess Containers 2021-05-19 16:24:14 -07:00
serviceaccount allow multiple of --service-account-issuer 2021-04-19 09:54:11 -07:00
util Merge pull request #102576 from dobsonj/101911 2021-06-29 06:54:40 -07:00
volume Keep pod worker running until pod is truly complete 2021-07-06 15:55:22 -04:00
windows/service hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
.import-restrictions
OWNERS Sign up dims for additional review roles 2020-08-08 19:08:38 -04:00