If err does not add continue, type conversion will be error.
If do not add continue, pod. (* V1.Pod) may cause panic to run.
This commit is contained in:
@@ -505,6 +505,7 @@ func (s *podStorage) MergedState() interface{} {
|
|||||||
pod, err := api.Scheme.Copy(podRef)
|
pod, err := api.Scheme.Copy(podRef)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("unable to copy pod: %v", err)
|
glog.Errorf("unable to copy pod: %v", err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
pods = append(pods, pod.(*v1.Pod))
|
pods = append(pods, pod.(*v1.Pod))
|
||||||
}
|
}
|
||||||
@@ -519,6 +520,7 @@ func copyPods(sourcePods []*v1.Pod) []*v1.Pod {
|
|||||||
pod, err := api.Scheme.Copy(source)
|
pod, err := api.Scheme.Copy(source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("unable to copy pod: %v", err)
|
glog.Errorf("unable to copy pod: %v", err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
pods = append(pods, pod.(*v1.Pod))
|
pods = append(pods, pod.(*v1.Pod))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user