mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-30 05:43:58 +00:00
Delete duplicate resource.Quantity.Copy()
This commit is contained in:
@@ -88,7 +88,7 @@ func checkNodeAllocatableTest(f *framework.Framework) {
|
||||
e2elog.Logf("nodeMem says: %+v", nodeMem)
|
||||
|
||||
// calculate the allocatable mem based on capacity - reserved amounts
|
||||
calculatedNodeAlloc := nodeMem.capacity.Copy()
|
||||
calculatedNodeAlloc := nodeMem.capacity.DeepCopy()
|
||||
calculatedNodeAlloc.Sub(nodeMem.systemReserve)
|
||||
calculatedNodeAlloc.Sub(nodeMem.kubeReserve)
|
||||
calculatedNodeAlloc.Sub(nodeMem.softEviction)
|
||||
|
||||
@@ -94,7 +94,7 @@ func getLocalNodeCPUDetails(f *framework.Framework) (cpuCapVal int64, cpuAllocVa
|
||||
cpuCap := localNodeCap[v1.ResourceCPU]
|
||||
localNodeAlloc := getLocalNode(f).Status.Allocatable
|
||||
cpuAlloc := localNodeAlloc[v1.ResourceCPU]
|
||||
cpuRes := cpuCap.Copy()
|
||||
cpuRes := cpuCap.DeepCopy()
|
||||
cpuRes.Sub(cpuAlloc)
|
||||
|
||||
// RoundUp reserved CPUs to get only integer cores.
|
||||
|
||||
@@ -89,11 +89,13 @@ func getAllocatableLimits(cpu, memory, pids string, capacity v1.ResourceList) (*
|
||||
// Total cpu reservation is 200m.
|
||||
for k, v := range capacity {
|
||||
if k == v1.ResourceCPU {
|
||||
allocatableCPU = v.Copy()
|
||||
c := v.DeepCopy()
|
||||
allocatableCPU = &c
|
||||
allocatableCPU.Sub(resource.MustParse(cpu))
|
||||
}
|
||||
if k == v1.ResourceMemory {
|
||||
allocatableMemory = v.Copy()
|
||||
c := v.DeepCopy()
|
||||
allocatableMemory = &c
|
||||
allocatableMemory.Sub(resource.MustParse(memory))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user