mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
kubelet: Avoid allocating multiple times during status
Noticed while reviewing this code path. We can assume the temporary slice should be about the same size as it was previously.
This commit is contained in:
parent
9efd40d72a
commit
c2a6d07b8f
@ -1782,7 +1782,7 @@ func (kl *Kubelet) convertToAPIContainerStatuses(pod *v1.Pod, podStatus *kubecon
|
||||
if isInitContainer {
|
||||
return kubetypes.SortStatusesOfInitContainers(pod, statuses)
|
||||
}
|
||||
var containerStatuses []v1.ContainerStatus
|
||||
containerStatuses := make([]v1.ContainerStatus, 0, len(statuses))
|
||||
for _, status := range statuses {
|
||||
containerStatuses = append(containerStatuses, *status)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user