mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
kubelet: Delete static pods gracefully
Add a new static pod after checking if its mirror pod is pending termination.
This commit is contained in:
parent
faaae71427
commit
9bcb451d7d
@ -1499,6 +1499,13 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the pod is a static pod and its mirror pod is still gracefully terminating,
|
||||||
|
// we do not want to start the new static pod until the old static pod is gracefully terminated.
|
||||||
|
podFullName := kubecontainer.GetPodFullName(pod)
|
||||||
|
if kl.podKiller.IsMirrorPodPendingTerminationByPodName(podFullName) {
|
||||||
|
return fmt.Errorf("pod %q is pending termination", podFullName)
|
||||||
|
}
|
||||||
|
|
||||||
// Latency measurements for the main workflow are relative to the
|
// Latency measurements for the main workflow are relative to the
|
||||||
// first time the pod was seen by the API server.
|
// first time the pod was seen by the API server.
|
||||||
var firstSeenTime time.Time
|
var firstSeenTime time.Time
|
||||||
@ -1634,7 +1641,6 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
|
|||||||
|
|
||||||
// Create Mirror Pod for Static Pod if it doesn't already exist
|
// Create Mirror Pod for Static Pod if it doesn't already exist
|
||||||
if kubetypes.IsStaticPod(pod) {
|
if kubetypes.IsStaticPod(pod) {
|
||||||
podFullName := kubecontainer.GetPodFullName(pod)
|
|
||||||
deleted := false
|
deleted := false
|
||||||
if mirrorPod != nil {
|
if mirrorPod != nil {
|
||||||
if mirrorPod.DeletionTimestamp != nil || !kl.podManager.IsMirrorPodOf(mirrorPod, pod) {
|
if mirrorPod.DeletionTimestamp != nil || !kl.podManager.IsMirrorPodOf(mirrorPod, pod) {
|
||||||
|
Loading…
Reference in New Issue
Block a user