Skip to content

Commit

Permalink
Merge pull request kubeedge#4368 from Shelley-BaoYue/bugfix-forcedele…
Browse files Browse the repository at this point in the history
…tepod

fix force delete pod when node offline
  • Loading branch information
kubeedge-bot authored Feb 14, 2023
2 parents 4ea332b + f56f6c4 commit e6adc9c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions edge/pkg/edged/edged.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"encoding/json"
"fmt"
"os"
"reflect"
"time"

"github.com/container-storage-interface/spec/lib/go/csi"
Expand Down Expand Up @@ -273,6 +274,19 @@ func (e *edged) handlePod(op string, content []byte, updatesChan chan<- interfac
return err
}

// When the edge node is offline and the pod in the node is deleted forcefully,
// and then we make the node online, We do not have the pod full information
// because the pod is deleted from the kube apiServer, then the syncController
// will send a message with the pod name, namespace and UID, so we can not filter
// pod according to the node name. So in this scenario, we query metadata from edge
// database and use func handlePodListFromMetaManager to sync with Kubelet.
if op == model.DeleteOperation && reflect.DeepEqual(pod.Spec, v1.PodSpec{}) {
info := model.NewMessage("").BuildRouter(e.Name(), e.Group(), e.namespace+"/"+model.ResourceTypePod,
model.QueryOperation)
beehiveContext.Send(modules.MetaManagerModuleName, *info)
return nil
}

var pods []*v1.Pod
pods = append(pods, &pod)

Expand Down

0 comments on commit e6adc9c

Please sign in to comment.