Skip to content

Commit

Permalink
Merge pull request #16464 from dcbw/fix-pod-ip-race
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue (batch tested with PRs 16591, 16597, 16464).

UPSTREAM: 47806: kubelet: fix inconsistent display of terminated pod IPs by using events instead

PLEG and kubelet race when reading and sending pod status to the apiserver.  PLEG
inserts status into a cache, and then signals kubelet.  Kubelet then eventually
reads the status out of that cache, but in the mean time the status could have
been changed by PLEG.

When a pod exits, pod status will no longer include the pod's IP address because
the network plugin/runtime will report "" for terminated pod IPs.  If this status
gets inserted into the PLEG cache before kubelet gets the status out of the cache,
kubelet will see a blank pod IP address.  This happens in about 1/5 of cases when
pods are short-lived, and somewhat less frequently for longer running pods.

To ensure consistency for properties of dead pods, copy an old status update's
IP address over to the new status update if (a) the new status update's IP is
missing and (b) all sandboxes of the pod are dead/not-ready (eg, no possibility
for a valid IP from the sandbox).

Fixes: kubernetes/kubernetes#47265
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1449373

@openshift/networking @knobunc @eparis
  • Loading branch information
openshift-merge-robot committed Sep 28, 2017
2 parents a96bb63 + 3ca93e7 commit 16a400f
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
1 change: 1 addition & 0 deletions vendor/k8s.io/kubernetes/pkg/kubelet/pleg/BUILD

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions vendor/k8s.io/kubernetes/pkg/kubelet/pleg/generic.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions vendor/k8s.io/kubernetes/pkg/kubelet/pleg/generic_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 16a400f

Please sign in to comment.