code: func (m *kubeGenericRuntimeManager) executePreStopHook(pod *v1.Pod, containerID kubecontainer.ContainerID, containerSpec *v1.Container, gracePeriod int64) int64 {
  	klog.V(3).Infof("Running preStop hook for container %q", containerID.String())
  
  	start := metav1.Now()
  	done := make(chan struct{})
  	go func() {
  		defer close(done)
  		defer utilruntime.HandleCrash()
  		if msg, err := m.runner.Run(containerID, pod, containerSpec, containerSpec.Lifecycle.PreStop); err != nil {
  			klog.Errorf("preStop hook for container %q failed: %v", containerSpec.Name, err)
  			m.recordContainerEvent(pod, containerSpec, containerID.ID, v1.EventTypeWarning, events.FailedPreStopHook, msg)
  		}
  	}()
  
  	select {
  	case <-time.After(time.Duration(gracePeriod) * time.Second):
  		klog.V(2).Infof("preStop hook for container %q did not complete in %d seconds", containerID, gracePeriod)
  	case <-done:
  		klog.V(3).Infof("preStop hook for container %q completed", containerID)
  	}
  
  	return int64(metav1.Now().Sub(start.Time).Seconds())
  }
docs: // executePreStopHook runs the pre-stop lifecycle hooks if applicable and returns the duration it takes.