mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 12:11:43 +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:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user