kubernetes/pkg/kubelet/prober
Kubernetes Submit Queue b641aedcac Merge pull request #46371 from sjenning/fix-liveness-probe-reset
Automatic merge from submit-queue

reset resultRun on pod restart

xref https://bugzilla.redhat.com/show_bug.cgi?id=1455056

There is currently an issue where, if the pod is restarted due to liveness probe failures exceeding failureThreshold, the failure count is not reset on the probe worker.  When the pod restarts, if the liveness probe fails even once, the pod is restarted again, not honoring failureThreshold on the restart.

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: busybox
spec:
  containers:
  - name: busybox
    image: busybox
    command:
    - sleep
    - "3600"
    livenessProbe:
      httpGet:
        path: /healthz
        port: 8080
      initialDelaySeconds: 3
      timeoutSeconds: 1
      periodSeconds: 3
      successThreshold: 1
      failureThreshold: 5
  terminationGracePeriodSeconds: 0
```

Before this PR:
```
$ kubectl create -f busybox-probe-fail.yaml 
pod "busybox" created
$ kubectl get pod -w
NAME      READY     STATUS    RESTARTS   AGE
busybox   1/1       Running   0          4s
busybox   1/1       Running   1         24s
busybox   1/1       Running   2         33s
busybox   0/1       CrashLoopBackOff   2         39s
```

After this PR:
```
$ kubectl create -f busybox-probe-fail.yaml
$ kubectl get pod -w
NAME      READY     STATUS              RESTARTS   AGE
busybox   0/1       ContainerCreating   0          2s
busybox   1/1       Running   0         4s
busybox   1/1       Running   1         27s
busybox   1/1       Running   2         45s
```

```release-note
Fix kubelet reset liveness probe failure count across pod restart boundaries
```

Restarts are now happen at even intervals.

@derekwaynecarr
2017-06-03 15:15:49 -07:00
..
results autogenerated 2017-04-14 10:40:57 -07:00
testing autogenerated 2017-04-14 10:40:57 -07:00
BUILD move pkg/api/v1/ref.go and pkg/api/v1/resource.go to subpackages. move some functions in resource.go to pkg/api/v1/node and pkg/api/v1/pod 2017-04-17 11:38:11 -07:00
common_test.go Migrate kubelet configmap management logic to an interface 2017-05-31 10:39:36 +02:00
prober_manager_test.go Fix gofmt errors 2017-03-28 17:12:04 -07:00
prober_manager.go move client/record 2017-01-31 19:14:13 -05:00
prober_test.go ExecProbes should be able to do simple env var substitution 2017-02-28 22:46:04 -05:00
prober.go Fix kubelet event recording 2017-05-22 17:24:36 -04:00
worker_test.go Merge pull request #46371 from sjenning/fix-liveness-probe-reset 2017-06-03 15:15:49 -07:00
worker.go reset resultRun on pod restart 2017-05-24 14:55:53 -05:00