Add error check to avoid panic

Signed-off-by: Cookie Wang <wangchl01@inspur.com>
pull/9640/head
Cookie Wang 4 years ago
parent a499b4b179
commit 8959d93711

@ -608,6 +608,9 @@ func (c *Client) WaitAndGetCompletedPodPhase(name string, timeout time.Duration)
FieldSelector: fmt.Sprintf("metadata.name=%s", name), FieldSelector: fmt.Sprintf("metadata.name=%s", name),
TimeoutSeconds: &to, TimeoutSeconds: &to,
}) })
if err != nil {
return v1.PodUnknown, err
}
for event := range watcher.ResultChan() { for event := range watcher.ResultChan() {
p, ok := event.Object.(*v1.Pod) p, ok := event.Object.(*v1.Pod)

Loading…
Cancel
Save