diff --git a/receiver/kubeletstatsreceiver/internal/kubelet/metadata.go b/receiver/kubeletstatsreceiver/internal/kubelet/metadata.go index 93013327b6cf..427b02fe9c0d 100644 --- a/receiver/kubeletstatsreceiver/internal/kubelet/metadata.go +++ b/receiver/kubeletstatsreceiver/internal/kubelet/metadata.go @@ -91,8 +91,8 @@ func NewMetadata(labels []MetadataLabel, podsMetadata *v1.PodList, allContainersCPURequestsDefined := true allContainersMemoryLimitsDefined := true allContainersMemoryRequestsDefined := true - for _, container := range pod.Spec.Containers { - // nolint G601 + for i := range pod.Spec.Containers { + container := pod.Spec.Containers[i] containerResource := getContainerResources(&container.Resources) if allContainersCPULimitsDefined && containerResource.cpuLimit == 0 {