Skip to content

Commit

Permalink
Merge pull request spidernet-io#3688 from ty-dc/fix/3651
Browse files Browse the repository at this point in the history
e2e fix: spiderpoolcontroller Pod termination failed
  • Loading branch information
weizhoublue authored Jul 21, 2024
2 parents aba8e36 + ccebaf5 commit e8945d2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/e2e/reclaim/reclaim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,21 @@ var _ = Describe("test ip with reclaim ip case", Label("reclaim"), func() {
commandStr := "systemctl stop kubelet"
output, err := frame.DockerExecCommand(ctx, workerNodeName, commandStr)
Expect(err).NotTo(HaveOccurred(), "Failed exec '%s' in docker container '%s', error is: %v,log: %v.", commandStr, workerNodeName, err, string(output))

DeferCleanup(func() {
// Prevent spiderpoolcontroller Pod termination failure
podList, err := frame.GetPodListByLabel(map[string]string{"app.kubernetes.io/component": constant.SpiderpoolController})
Expect(err).NotTo(HaveOccurred(), "Failed get SpiderpoolController Pod list, error is: %v", err)
var deletePodList *corev1.PodList
for _, spiderpoolControllerPod := range podList.Items {
if spiderpoolControllerPod.Spec.NodeName == workerNodeName {
deletePodList = &corev1.PodList{
Items: []corev1.Pod{spiderpoolControllerPod},
}
}
}
Expect(frame.DeletePodList(deletePodList)).NotTo(HaveOccurred(), client.DeleteOptions{GracePeriodSeconds: ptr.To(int64(0))})

commandStr = "systemctl start kubelet"
output, err = frame.DockerExecCommand(ctx, workerNodeName, commandStr)
Expect(err).NotTo(HaveOccurred(), "Failed exec '%s' in docker container '%s', error is: %v,log: %v.", commandStr, workerNodeName, err, string(output))
Expand Down

0 comments on commit e8945d2

Please sign in to comment.