diff --git a/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy.go b/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy.go index 436d12d8ed..6a3f49dd5d 100644 --- a/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy.go +++ b/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy.go @@ -1192,7 +1192,7 @@ func (p *DynamicPolicy) checkNormalShareCoresCpuResource(req *pluginapi.Resource } for _, allocation := range podEntry { // shareCoresAllocated should involve both main and sidecar containers - if state.CheckShared(allocation) && !allocation.CheckNumaBinding() { + if state.CheckShared(allocation) && !state.CheckNUMABinding(allocation) { shareCoresAllocated += p.getContainerRequestedCores(allocation) } } diff --git a/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy_hint_handlers.go b/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy_hint_handlers.go index eadf14ccda..73efaf3750 100644 --- a/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy_hint_handlers.go +++ b/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy_hint_handlers.go @@ -52,6 +52,7 @@ func (p *DynamicPolicy) sharedCoresHintHandler(ctx context.Context, return p.sharedCoresWithNUMABindingHintHandler(ctx, req) } + // TODO: support sidecar follow main container for normal share cores in future if req.ContainerType == pluginapi.ContainerType_MAIN { ok, err := p.checkNormalShareCoresCpuResource(req) if err != nil { @@ -544,7 +545,10 @@ func (p *DynamicPolicy) sharedCoresWithNUMABindingHintHandler(_ context.Context, if allocationInfo != nil { hints = cpuutil.RegenerateHints(allocationInfo, reqInt) - // regenerateHints failed. need to clear container record and re-calculate. + // clear the current container and regenerate machine state in follow cases: + // 1. regenerateHints failed. + // 2. the container is inplace update resizing. + // hints it as a new container if hints == nil || util.PodInplaceUpdateResizing(req) { machineState, err = p.clearContainerAndRegenerateMachineState(podEntries, req) if err != nil { @@ -565,7 +569,7 @@ func (p *DynamicPolicy) sharedCoresWithNUMABindingHintHandler(_ context.Context, if numaset.Size() != 1 { general.Errorf("pod: %s/%s, container: %s is snb, but its numa set size is %d", req.PodNamespace, req.PodName, req.ContainerName, numaset.Size()) - return nil, fmt.Errorf("snb port not suport cross numa") + return nil, fmt.Errorf("snb port not support cross numa") } nodeID := numaset.ToSliceInt()[0] availableCPUQuantity := machineState[nodeID].GetAvailableCPUQuantity(p.reservedCPUs) diff --git a/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy_test.go b/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy_test.go index b0f6c7054f..605ac564e5 100644 --- a/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy_test.go +++ b/pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy_test.go @@ -5196,7 +5196,7 @@ func TestSNBAdmitWithSidecarReallocate(t *testing.T) { dynamicPolicy.podAnnotationKeptKeys = []string{ consts.PodAnnotationMemoryEnhancementNumaBinding, - consts.PodAnnotationVPAResizingKey, + consts.PodAnnotationInplaceUpdateResizingKey, consts.PodAnnotationAggregatedRequestsKey, } diff --git a/pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/state.go b/pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/state.go index 17649a927c..c8576e3c1b 100644 --- a/pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/state.go +++ b/pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/state.go @@ -202,12 +202,6 @@ func (ai *AllocationInfo) CheckMainContainer() bool { return ai.ContainerType == pluginapi.ContainerType_MAIN.String() } -// CheckNumaBinding returns true if the AllocationInfo is for pod with numa-binding enhancement -func (ai *AllocationInfo) CheckNumaBinding() bool { - return ai.Annotations[consts.PodAnnotationMemoryEnhancementNumaBinding] == - consts.PodAnnotationMemoryEnhancementNumaBindingEnable -} - // GetAllocationResultNUMASet returns numaSet parsed from TopologyAwareAssignments func (ai *AllocationInfo) GetAllocationResultNUMASet() machine.CPUSet { if ai == nil { diff --git a/pkg/agent/qrm-plugins/cpu/dynamicpolicy/vpa_test.go b/pkg/agent/qrm-plugins/cpu/dynamicpolicy/vpa_test.go index ae958344d3..a866e26064 100644 --- a/pkg/agent/qrm-plugins/cpu/dynamicpolicy/vpa_test.go +++ b/pkg/agent/qrm-plugins/cpu/dynamicpolicy/vpa_test.go @@ -48,7 +48,7 @@ func TestSNBVPA(t *testing.T) { dynamicPolicy, err := getTestDynamicPolicyWithInitialization(cpuTopology, tmpDir) as.Nil(err) - dynamicPolicy.podAnnotationKeptKeys = []string{consts.PodAnnotationVPAResizingKey} + dynamicPolicy.podAnnotationKeptKeys = []string{consts.PodAnnotationInplaceUpdateResizingKey} testName := "test" @@ -132,9 +132,9 @@ func TestSNBVPA(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationVPAResizingKey: "true", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationInplaceUpdateResizingKey: "true", }, } @@ -157,9 +157,9 @@ func TestSNBVPA(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationVPAResizingKey: "true", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationInplaceUpdateResizingKey: "true", }, } @@ -183,9 +183,9 @@ func TestSNBVPA(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationVPAResizingKey: "true", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationInplaceUpdateResizingKey: "true", }, Hint: resizeHints1[0], } @@ -223,7 +223,7 @@ func TestSNBVPAWithSidecar(t *testing.T) { as.Nil(err) dynamicPolicy.podAnnotationKeptKeys = []string{ - consts.PodAnnotationVPAResizingKey, + consts.PodAnnotationInplaceUpdateResizingKey, consts.PodAnnotationAggregatedRequestsKey, } @@ -404,10 +404,10 @@ func TestSNBVPAWithSidecar(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"4\"}", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"4\"}", }, } @@ -430,10 +430,10 @@ func TestSNBVPAWithSidecar(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"4\"}", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"4\"}", }, Hint: resizeMainContainerHints[0], } @@ -490,10 +490,10 @@ func TestSNBVPAWithSidecar(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"5\"}", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"5\"}", }, } @@ -515,10 +515,10 @@ func TestSNBVPAWithSidecar(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"5\"}", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"5\"}", }, } _, err = dynamicPolicy.Allocate(context.Background(), resizeSidecarContainerReq) @@ -539,10 +539,10 @@ func TestSNBVPAWithSidecar(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"5\"}", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"5\"}", }, } resizeMainContainerResp, err = dynamicPolicy.GetTopologyHints(context.Background(), resizeMainContainerReq) @@ -563,10 +563,10 @@ func TestSNBVPAWithSidecar(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"5\"}", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"5\"}", }, Hint: resizeMainContainerResp.ResourceHints[string(v1.ResourceCPU)].Hints[0], } @@ -634,7 +634,7 @@ func TestNormalShareVPA(t *testing.T) { dynamicPolicy, err := getTestDynamicPolicyWithInitialization(cpuTopology, tmpDir) as.Nil(err) - dynamicPolicy.podAnnotationKeptKeys = []string{consts.PodAnnotationMemoryEnhancementNumaBinding, consts.PodAnnotationVPAResizingKey} + dynamicPolicy.podAnnotationKeptKeys = []string{consts.PodAnnotationMemoryEnhancementNumaBinding, consts.PodAnnotationInplaceUpdateResizingKey} dynamicPolicy.transitionPeriod = 10 * time.Millisecond testName := "test" @@ -702,8 +702,8 @@ func TestNormalShareVPA(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", }, } @@ -725,8 +725,8 @@ func TestNormalShareVPA(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", }, } @@ -779,7 +779,7 @@ func TestNormalShareVPAWithSidecar(t *testing.T) { dynamicPolicy.podAnnotationKeptKeys = []string{ consts.PodAnnotationMemoryEnhancementNumaBinding, - consts.PodAnnotationVPAResizingKey, + consts.PodAnnotationInplaceUpdateResizingKey, consts.PodAnnotationAggregatedRequestsKey, } @@ -914,9 +914,9 @@ func TestNormalShareVPAWithSidecar(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"4\"}", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"4\"}", }, } @@ -982,9 +982,9 @@ func TestNormalShareVPAWithSidecar(t *testing.T) { consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"5\"}", + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationAggregatedRequestsKey: "{\"cpu\":\"5\"}", }, } diff --git a/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_allocation_handlers.go b/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_allocation_handlers.go index 5738ad606c..b1d80fe64c 100644 --- a/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_allocation_handlers.go +++ b/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_allocation_handlers.go @@ -135,14 +135,10 @@ func (p *DynamicPolicy) numaBindingAllocationHandler(ctx context.Context, "memoryReq(bytes)", podAggregatedRequest, "currentResult(bytes)", allocationInfo.AggregatedQuantity) - if util.PodInplaceUpdateResizing(req) { - // remove the main container of this pod (the main container involve the whole pod requests) - containerEntries := podEntries[req.PodUid] - delete(containerEntries, req.ContainerName) - } else { - // TODO ---> jianyu confirm - delete(podEntries, req.PodUid) - } + // remove the main container of this pod (the main container involve the whole pod requests), and the + // sidecar container request in state is zero. + containerEntries := podEntries[req.PodUid] + delete(containerEntries, req.ContainerName) var stateErr error memoryState, stateErr = state.GenerateMemoryStateFromPodEntries(p.state.GetMachineInfo(), podEntries, p.state.GetReservedMemory()) diff --git a/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_hint_handlers.go b/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_hint_handlers.go index 5b97f06e55..29273c30a9 100644 --- a/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_hint_handlers.go +++ b/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_hint_handlers.go @@ -44,6 +44,7 @@ func (p *DynamicPolicy) sharedCoresHintHandler(ctx context.Context, return p.numaBindingHintHandler(ctx, req) } + // TODO: support sidecar follow main container for normal share cores in future if req.ContainerType == pluginapi.ContainerType_MAIN { ok, err := p.checkNormalShareCoresResource(req) if err != nil { @@ -129,10 +130,13 @@ func (p *DynamicPolicy) numaBindingHintHandler(_ context.Context, } hints = regenerateHints(uint64(podAggregatedRequest), allocationInfo, util.PodInplaceUpdateResizing(req)) - // regenerateHints failed, and we need to clear container record and re-calculate. + // clear the current container and regenerate machine state in follow cases: + // 1. regenerateHints failed. + // 2. the container is inplace update resizing. + // hints it as a new container if hints == nil || util.PodInplaceUpdateResizing(req) { var err error - resourcesMachineState, err = p.clearPodAndRegenerateMachineState(req) + resourcesMachineState, err = p.clearContainerAndRegenerateMachineState(req) if err != nil { general.Errorf("pod: %s/%s, container: %s GenerateMachineStateFromPodEntries failed with error: %v", req.PodNamespace, req.PodName, req.ContainerName, err) @@ -215,11 +219,12 @@ func (p *DynamicPolicy) numaBindingHintHandler(_ context.Context, return util.PackResourceHintsResponse(req, string(v1.ResourceMemory), hints) } -func (p *DynamicPolicy) clearPodAndRegenerateMachineState(req *pluginapi.ResourceRequest) (state.NUMANodeResourcesMap, error) { +func (p *DynamicPolicy) clearContainerAndRegenerateMachineState(req *pluginapi.ResourceRequest) (state.NUMANodeResourcesMap, error) { podResourceEntries := p.state.GetPodResourceEntries() - for resourceName, podEntries := range podResourceEntries { - if resourceName == v1.ResourceMemory { + for _, podEntries := range podResourceEntries { + delete(podEntries[req.PodUid], req.ContainerName) + if len(podEntries[req.PodUid]) == 0 { delete(podEntries, req.PodUid) } } diff --git a/pkg/agent/qrm-plugins/memory/dynamicpolicy/vpa_test.go b/pkg/agent/qrm-plugins/memory/dynamicpolicy/vpa_test.go index ca79cb6aab..c0a1ddeac3 100644 --- a/pkg/agent/qrm-plugins/memory/dynamicpolicy/vpa_test.go +++ b/pkg/agent/qrm-plugins/memory/dynamicpolicy/vpa_test.go @@ -49,7 +49,7 @@ func TestSNBMemoryVPA(t *testing.T) { dynamicPolicy, err := getTestDynamicPolicyWithInitialization(cpuTopology, machineInfo, tmpDir) as.Nil(err) dynamicPolicy.podAnnotationKeptKeys = []string{ - consts.PodAnnotationVPAResizingKey, + consts.PodAnnotationInplaceUpdateResizingKey, consts.PodAnnotationAggregatedRequestsKey, } @@ -126,9 +126,9 @@ func TestSNBMemoryVPA(t *testing.T) { string(v1.ResourceMemory): 4294967296, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -154,9 +154,9 @@ func TestSNBMemoryVPA(t *testing.T) { string(v1.ResourceMemory): 4294967296, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -188,9 +188,9 @@ func TestSNBMemoryVPA(t *testing.T) { string(v1.ResourceMemory): 8 * 1024 * 1024 * 1024, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -219,7 +219,7 @@ func TestSNBMemoryVPAWithSidecar(t *testing.T) { as.Nil(err) dynamicPolicy.podAnnotationKeptKeys = []string{ consts.PodAnnotationMemoryEnhancementNumaBinding, - consts.PodAnnotationVPAResizingKey, + consts.PodAnnotationInplaceUpdateResizingKey, consts.PodAnnotationAggregatedRequestsKey, } @@ -390,10 +390,10 @@ func TestSNBMemoryVPAWithSidecar(t *testing.T) { string(v1.ResourceMemory): 4294967296, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationAggregatedRequestsKey: `{"memory": 6442450944}`, // sidecar 2G + main 4G + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationAggregatedRequestsKey: `{"memory": 6442450944}`, // sidecar 2G + main 4G }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -418,10 +418,10 @@ func TestSNBMemoryVPAWithSidecar(t *testing.T) { string(v1.ResourceMemory): 4294967296, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationAggregatedRequestsKey: `{"memory": 6442450944}`, // sidecar 2G + main 4G + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationAggregatedRequestsKey: `{"memory": 6442450944}`, // sidecar 2G + main 4G }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -457,10 +457,10 @@ func TestSNBMemoryVPAWithSidecar(t *testing.T) { string(v1.ResourceMemory): 3 * 1024 * 1024 * 1024, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationAggregatedRequestsKey: `{"memory": 7516192768}`, // sidecar 3G + main 4G + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationAggregatedRequestsKey: `{"memory": 7516192768}`, // sidecar 3G + main 4G }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -485,10 +485,10 @@ func TestSNBMemoryVPAWithSidecar(t *testing.T) { string(v1.ResourceMemory): 3 * 1024 * 1024 * 1024, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationAggregatedRequestsKey: `{"memory": 7516192768}`, // sidecar 3G + main 4G + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationAggregatedRequestsKey: `{"memory": 7516192768}`, // sidecar 3G + main 4G }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -510,10 +510,10 @@ func TestSNBMemoryVPAWithSidecar(t *testing.T) { string(v1.ResourceMemory): 4294967296, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationAggregatedRequestsKey: `{"memory": 7516192768}`, // sidecar 2G + main 4G + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationAggregatedRequestsKey: `{"memory": 7516192768}`, // sidecar 2G + main 4G }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -538,10 +538,10 @@ func TestSNBMemoryVPAWithSidecar(t *testing.T) { string(v1.ResourceMemory): 4294967296, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationAggregatedRequestsKey: `{"memory": 7516192768}`, // sidecar 2G + main 4G + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationAggregatedRequestsKey: `{"memory": 7516192768}`, // sidecar 2G + main 4G }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -577,10 +577,10 @@ func TestSNBMemoryVPAWithSidecar(t *testing.T) { string(v1.ResourceMemory): 32 * 1024 * 1024 * 1024, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationAggregatedRequestsKey: `{"memory": 37580963840}`, // sidecar 2G + main 4G + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationAggregatedRequestsKey: `{"memory": 37580963840}`, // sidecar 2G + main 4G }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -602,10 +602,10 @@ func TestSNBMemoryVPAWithSidecar(t *testing.T) { string(v1.ResourceMemory): 32 * 1024 * 1024 * 1024, }, Annotations: map[string]string{ - consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, - consts.PodAnnotationVPAResizingKey: "true", - consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, - consts.PodAnnotationAggregatedRequestsKey: `{"memory": 37580963840}`, // sidecar 3G + main 4G + consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, + consts.PodAnnotationInplaceUpdateResizingKey: "true", + consts.PodAnnotationMemoryEnhancementKey: `{"numa_binding": "true", "numa_exclusive": "false"}`, + consts.PodAnnotationAggregatedRequestsKey: `{"memory": 37580963840}`, // sidecar 3G + main 4G }, Labels: map[string]string{ consts.PodAnnotationQoSLevelKey: consts.PodAnnotationQoSLevelSharedCores, @@ -636,7 +636,7 @@ func TestNormalShareMemoryVPA(t *testing.T) { as.Nil(err) dynamicPolicy.podAnnotationKeptKeys = []string{ consts.PodAnnotationMemoryEnhancementNumaBinding, - consts.PodAnnotationVPAResizingKey, + consts.PodAnnotationInplaceUpdateResizingKey, consts.PodAnnotationAggregatedRequestsKey, } @@ -745,7 +745,7 @@ func TestNormalShareMemoryVPAWithSidecar(t *testing.T) { as.Nil(err) dynamicPolicy.podAnnotationKeptKeys = []string{ consts.PodAnnotationMemoryEnhancementNumaBinding, - consts.PodAnnotationVPAResizingKey, + consts.PodAnnotationInplaceUpdateResizingKey, consts.PodAnnotationAggregatedRequestsKey, }