Skip to content

Commit

Permalink
Merge pull request kubewharf#681 from nightmeng/dev/fix-reclaim-core-…
Browse files Browse the repository at this point in the history
…hints

feat(qrm): fix reclaimed cores topology hints
  • Loading branch information
nightmeng authored Aug 23, 2024
2 parents 0efda71 + 99996fc commit cb9c984
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy_hint_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,18 @@ func (p *DynamicPolicy) sharedCoresHintHandler(ctx context.Context,
func (p *DynamicPolicy) reclaimedCoresHintHandler(ctx context.Context,
req *pluginapi.ResourceRequest,
) (*pluginapi.ResourceHintsResponse, error) {
if req == nil {
return nil, fmt.Errorf("got nil request")
}

if util.PodInplaceUpdateResizing(req) {
return nil, fmt.Errorf("not support inplace update resize for reclaimed cores")
}
return p.sharedCoresHintHandler(ctx, req)

return util.PackResourceHintsResponse(req, string(v1.ResourceCPU),
map[string]*pluginapi.ListOfTopologyHints{
string(v1.ResourceCPU): nil, // indicates that there is no numa preference
})
}

func (p *DynamicPolicy) dedicatedCoresHintHandler(ctx context.Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,20 @@ func (p *DynamicPolicy) sharedCoresHintHandler(ctx context.Context,
func (p *DynamicPolicy) reclaimedCoresHintHandler(ctx context.Context,
req *pluginapi.ResourceRequest,
) (*pluginapi.ResourceHintsResponse, error) {
if req == nil {
return nil, fmt.Errorf("got nil request")
}

if util.PodInplaceUpdateResizing(req) {
general.Errorf("pod: %s/%s, container: %s request to memory inplace update resize, but not support reclaimed cores",
req.PodNamespace, req.PodName, req.ContainerName)
return nil, fmt.Errorf("not support inplace update resize for reclaimed cores")
}
return p.sharedCoresHintHandler(ctx, req)

return util.PackResourceHintsResponse(req, string(v1.ResourceMemory),
map[string]*pluginapi.ListOfTopologyHints{
string(v1.ResourceMemory): nil, // indicates that there is no numa preference
})
}

func (p *DynamicPolicy) dedicatedCoresHintHandler(ctx context.Context,
Expand Down

0 comments on commit cb9c984

Please sign in to comment.