mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 06:01:50 +00:00
Send a pod event if preStop hook did not finish in time.
This commit is contained in:
@@ -1529,6 +1529,8 @@ func (dm *DockerManager) killContainer(containerID kubecontainer.ContainerID, co
|
|||||||
select {
|
select {
|
||||||
case <-time.After(time.Duration(gracePeriod) * time.Second):
|
case <-time.After(time.Duration(gracePeriod) * time.Second):
|
||||||
glog.Warningf("preStop hook for container %q did not complete in %d seconds", name, gracePeriod)
|
glog.Warningf("preStop hook for container %q did not complete in %d seconds", name, gracePeriod)
|
||||||
|
message := fmt.Sprintf("preStop hook for container %q did not complete in %d seconds", name, gracePeriod)
|
||||||
|
dm.generateFailedContainerEvent(containerID, pod.Name, events.UnfinishedPreStopHook, message)
|
||||||
case <-done:
|
case <-done:
|
||||||
glog.V(4).Infof("preStop hook for container %q completed", name)
|
glog.V(4).Infof("preStop hook for container %q completed", name)
|
||||||
}
|
}
|
||||||
|
@@ -72,6 +72,7 @@ const (
|
|||||||
FailedValidation = "FailedValidation"
|
FailedValidation = "FailedValidation"
|
||||||
|
|
||||||
// Lifecycle hooks
|
// Lifecycle hooks
|
||||||
FailedPostStartHook = "FailedPostStartHook"
|
FailedPostStartHook = "FailedPostStartHook"
|
||||||
FailedPreStopHook = "FailedPreStopHook"
|
FailedPreStopHook = "FailedPreStopHook"
|
||||||
|
UnfinishedPreStopHook = "UnfinishedPreStopHook"
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user