Skip to content

Commit

Permalink
uses getlive pod for failure case, which skips delete as it is
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbtv committed Dec 19, 2024
1 parent 5338017 commit 79dc92a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pkg/k8sclient/k8sclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ func (c *ClientInfo) GetPodContext(ctx context.Context, namespace, name string)
return c.Client.CoreV1().Pods(namespace).Get(ctx, name, metav1.GetOptions{})
}

func (c *ClientInfo) GetPodLive(namespace, name string) (*v1.Pod, error) {
return c.Client.CoreV1().Pods(namespace).Get(context.TODO(), name, metav1.GetOptions{})
}

Check warning on line 96 in pkg/k8sclient/k8sclient.go

View workflow job for this annotation

GitHub Actions / test (1.22.x, ubuntu-latest)

exported method ClientInfo.GetPodLive should have comment or be unexported

Check warning on line 96 in pkg/k8sclient/k8sclient.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

exported method ClientInfo.GetPodLive should have comment or be unexported

// DeletePod deletes a pod from kubernetes
func (c *ClientInfo) DeletePod(namespace, name string) error {
return c.Client.CoreV1().Pods(namespace).Delete(context.TODO(), name, metav1.DeleteOptions{})
Expand Down
4 changes: 1 addition & 3 deletions pkg/multus/multus.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,7 @@ func GetPod(kubeClient *k8s.ClientInfo, k8sArgs *types.K8sArgs, isDel bool) (*v1
// Try one more time to get the pod directly from the apiserver;
// TODO: figure out why static pods don't show up via the informer
// and always hit this case.
ctx, cancel := context.WithTimeout(context.TODO(), pollDuration)
defer cancel()
pod, err = kubeClient.GetPodContext(ctx, podNamespace, podName)
pod, err = kubeClient.GetPodLive(podNamespace, podName)
if err != nil {
return nil, cmdErr(k8sArgs, "error waiting for pod: %v", err)
}
Expand Down

0 comments on commit 79dc92a

Please sign in to comment.