use copy() instead of a loop

This commit is contained in:
wongearl 2022-08-29 17:55:16 +08:00
parent 50097acf15
commit 47bd712b81

View File

@ -1587,9 +1587,7 @@ func (kl *Kubelet) convertStatusToAPIStatus(pod *v1.Pod, podStatus *kubecontaine
// copy pod status IPs to avoid race conditions with PodStatus #102806
podIPs := make([]string, len(podStatus.IPs))
for j, ip := range podStatus.IPs {
podIPs[j] = ip
}
copy(podIPs, podStatus.IPs)
// make podIPs order match node IP family preference #97979
podIPs = kl.sortPodIPs(podIPs)