mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #91716 from kadisi/append_mutations_kubelet
fix unexpected append mutations about pkg/kubelet package
This commit is contained in:
commit
86ab25f038
@ -69,10 +69,7 @@ func NewCgroupName(base CgroupName, components ...string) CgroupName {
|
||||
panic(fmt.Errorf("invalid character in component [%q] of CgroupName", component))
|
||||
}
|
||||
}
|
||||
// copy data from the base cgroup to eliminate cases where CgroupNames share underlying slices. See #68416
|
||||
baseCopy := make([]string, len(base))
|
||||
copy(baseCopy, base)
|
||||
return CgroupName(append(baseCopy, components...))
|
||||
return CgroupName(append(append([]string{}, base...), components...))
|
||||
}
|
||||
|
||||
func escapeSystemdCgroupName(part string) string {
|
||||
|
@ -73,7 +73,7 @@ func (m *unsupportedCgroupManager) ReduceCPULimits(cgroupName CgroupName) error
|
||||
var RootCgroupName = CgroupName([]string{})
|
||||
|
||||
func NewCgroupName(base CgroupName, components ...string) CgroupName {
|
||||
return CgroupName(append(base, components...))
|
||||
return append(append([]string{}, base...), components...)
|
||||
}
|
||||
|
||||
func (cgroupName CgroupName) ToSystemd() string {
|
||||
|
@ -164,7 +164,7 @@ func addAllocatableThresholds(thresholds []evictionapi.Threshold) []evictionapi.
|
||||
})
|
||||
}
|
||||
}
|
||||
return append(thresholds, additionalThresholds...)
|
||||
return append(append([]evictionapi.Threshold{}, thresholds...), additionalThresholds...)
|
||||
}
|
||||
|
||||
// parseThresholdStatements parses the input statements into a list of Threshold objects.
|
||||
|
@ -135,7 +135,7 @@ func (p *cadvisorStatsProvider) ListPodStats() ([]statsapi.PodStats, error) {
|
||||
if vstats, found := p.resourceAnalyzer.GetPodVolumeStats(podUID); found {
|
||||
ephemeralStats = make([]statsapi.VolumeStats, len(vstats.EphemeralVolumes))
|
||||
copy(ephemeralStats, vstats.EphemeralVolumes)
|
||||
podStats.VolumeStats = append(vstats.EphemeralVolumes, vstats.PersistentVolumes...)
|
||||
podStats.VolumeStats = append(append([]statsapi.VolumeStats{}, vstats.EphemeralVolumes...), vstats.PersistentVolumes...)
|
||||
}
|
||||
podStats.EphemeralStorage = calcEphemeralStorage(podStats.Containers, ephemeralStats, &rootFsInfo, nil, false)
|
||||
// Lookup the pod-level cgroup's CPU and memory stats
|
||||
|
@ -412,7 +412,7 @@ func (p *criStatsProvider) makePodStorageStats(s *statsapi.PodStats, rootFsInfo
|
||||
}
|
||||
ephemeralStats := make([]statsapi.VolumeStats, len(vstats.EphemeralVolumes))
|
||||
copy(ephemeralStats, vstats.EphemeralVolumes)
|
||||
s.VolumeStats = append(vstats.EphemeralVolumes, vstats.PersistentVolumes...)
|
||||
s.VolumeStats = append(append([]statsapi.VolumeStats{}, vstats.EphemeralVolumes...), vstats.PersistentVolumes...)
|
||||
s.EphemeralStorage = calcEphemeralStorage(s.Containers, ephemeralStats, rootFsInfo, logStats, true)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user