Skip to content

koordlet: support evict yarn container #2464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jimmysenior
Copy link

Ⅰ. Describe what this PR does

suport evict container of yarn nodemanager
when koordlet config --evict-by-copilot-agent=true,the memory evict and cpu evict will send requet to component of copilot-agent through socket ,which pod to be evicted is yarn nodemanager. And the actual logic of evict will finished on the component of opilot-agent.

Ⅱ. Does this pull request fix one issue?

NONE

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

when need use this feature, need merge pr of yarn-copilot and charts also
koordinator-sh/yarn-copilot#99
koordinator-sh/charts#94

V. Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests
  • All checks passed in make test

@koordinator-bot koordinator-bot bot requested review from hormes and saintube June 3, 2025 08:09
@koordinator-bot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign yihuifeng after the PR has been reviewed.
You can assign the PR to them by writing /assign @yihuifeng in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

codecov bot commented Jun 3, 2025

Codecov Report

Attention: Patch coverage is 76.52582% with 50 lines in your changes missing coverage. Please review.

Project coverage is 66.06%. Comparing base (73fa323) to head (bfc4987).
Report is 43 commits behind head on main.

Files with missing lines Patch % Lines
.../qosmanager/helpers/copilot/mock_copilot_server.go 58.00% 16 Missing and 5 partials ⚠️
.../koordlet/qosmanager/plugins/cpuevict/cpu_evict.go 74.54% 11 Missing and 3 partials ⚠️
...let/qosmanager/plugins/memoryevict/memory_evict.go 78.18% 10 Missing and 2 partials ⚠️
...ordlet/qosmanager/helpers/copilot/copilot_agent.go 90.62% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2464      +/-   ##
==========================================
+ Coverage   65.93%   66.06%   +0.13%     
==========================================
  Files         477      484       +7     
  Lines       56194    56910     +716     
==========================================
+ Hits        37049    37596     +547     
- Misses      16461    16566     +105     
- Partials     2684     2748      +64     
Flag Coverage Δ
unittests 66.06% <76.52%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jimmysenior jimmysenior force-pushed the feature/koordlet-support-evict-yarn-container branch from 76a95cf to 8b7980c Compare June 3, 2025 09:03
@saintube saintube requested a review from zwzhang0107 June 10, 2025 07:37
@@ -20,6 +20,8 @@ import (
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/record"

"github.com/koordinator-sh/koordinator/pkg/koordlet/qosmanager/plugins/copilot"
Copy link
Member

@saintube saintube Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The copilot agent seems not to be a QoS plugin, but an implementation of the framework.Evictor.
  2. The QoS plugin should not be referenced in framework/options.go. Instead, try to register the plugin in plugins/register.go.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copilot agent is not a implementation of the framework.Evictor, it is only a part of cpu evict or memory evict. It is inappropriate to register the plugin in plugins/register.go. It is essentially just used for communicating with Copilot, based on file sockets. Do you think it is feasible to place the copilot in the directory of koordinator/pkg/koordlet/qosmanager/helpers?

@saintube saintube changed the title Koordlet:support evict yarn container koordlet: support evict yarn container Jun 10, 2025

func isYarnNodeManager(pod *podEvictCPUInfo) bool {
targetKey := "app.kubernetes.io/component"
targetValue := "node-manager"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider to be configurable?

@songtao98 songtao98 added this to the v1.7 milestone Jun 10, 2025
@jimmysenior jimmysenior force-pushed the feature/koordlet-support-evict-yarn-container branch from 157390b to bfc4987 Compare July 10, 2025 02:25
@zwzhang0107
Copy link
Contributor

/lgtm

"testing"
"time"

"sigs.k8s.io/controller-runtime/pkg/manager/signals"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need goimports

imports are recommended to be organized like:

<buit-in pkgs>

<third-party pkgs>

<koordinator pkgs>

)

func TestKillContainerByResource(t *testing.T) {
// 1. 配置 Socket 路径
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please comment in English

}
listener, err := net.Listen("unix", y.unixPath)
if err != nil {
fmt.Printf("Failed to listen UNIX socket: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use klog.Fatalf instead of fmt.Printf

hasKillPods = true
} else {
klog.V(5).Infof("cpuEvict pick pod %s to evict, failed", util.GetPodKey(bePod.pod))
klog.Warningf("BatchCPU resource not found in resource list")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to log with the pod info

@ZiMengSheng ZiMengSheng added area/koordlet area/YARN colocate yarn with k8s labels Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants