From 8959d93711b94bba9c6f94aabe3e77d0eb504220 Mon Sep 17 00:00:00 2001 From: Cookie Wang Date: Thu, 22 Apr 2021 16:36:04 +0800 Subject: [PATCH] Add error check to avoid panic Signed-off-by: Cookie Wang --- pkg/kube/client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 34079e7a0..d862459aa 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -608,6 +608,9 @@ func (c *Client) WaitAndGetCompletedPodPhase(name string, timeout time.Duration) FieldSelector: fmt.Sprintf("metadata.name=%s", name), TimeoutSeconds: &to, }) + if err != nil { + return v1.PodUnknown, err + } for event := range watcher.ResultChan() { p, ok := event.Object.(*v1.Pod)