-
Notifications
You must be signed in to change notification settings - Fork 402
support reserved cpus #681
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
Conversation
@@ -120,6 +120,12 @@ func BuildNodeResourceTopology(sysPath string, kubeletConfig *kubeletconfiginter | |||
nrtBuilder.WithReservedCPUs(getNumReservedCPUs(reserved)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If flag --reserved-cpus
of kubelet is specified, it will overwrite the cpu setting in KubeReserved and SystemReserved. So I think we should also modify this line to set a correct reserved cpus. Also, we should also modify this function to build a correct reserved cpuset for all numa nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we need to update allocatable resources for all numa nodes, which have a impact on scheduling. If --reserved-cpus
is specified, I guess all allocatable cpu resource here is incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
|
||
func shouldExcludeReservedCPUs(pod *corev1.Pod) bool { | ||
if pod == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: actually we don't need to check because all pods listed from kubelet must not be nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a protection for panic...
@@ -474,6 +474,10 @@ func (cm *cpuManager) reconcileState() (success []reconciledContainer, failure [ | |||
} | |||
|
|||
cset := cm.state.GetCPUSetOrDefault(string(pod.UID), container.Name) | |||
if shouldExcludeReservedCPUs(pod) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it seems we only need to determine once, so store this flag and avoid determine again in L492 is better. And I think we could also move this line close to L492.
6651cba
to
6173110
Compare
🎉 Successfully Build Images. Docker RegistryOverview: https://hub.docker.com/u/gocrane
Quick Deploy - Helm helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace \
--set craned.image.repository=gocrane/craned \
--set craned.image.tag=pr-681-ed6727e \
--set metricAdapter.image.repository=gocrane/metric-adapter \
--set metricAdapter.image.tag=pr-681-ed6727e \
--set craneAgent.image.repository=gocrane/crane-agent \
--set craneAgent.image.tag=pr-681-ed6727e \
--set cranedDashboard.image.repository=gocrane/dashboard \
--set cranedDashboard.image.tag=pr-681-ed6727e crane/crane Coding RegistryOverview: https://finops.coding.net/public-artifacts/gocrane/crane/packages
Quick Deploy - Helm helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace \
--set craned.image.repository=finops-docker.pkg.coding.net/gocrane/crane/craned \
--set craned.image.tag=pr-681-ed6727e \
--set metricAdapter.image.repository=finops-docker.pkg.coding.net/gocrane/crane/metric-adapter \
--set metricAdapter.image.tag=pr-681-ed6727e \
--set craneAgent.image.repository=finops-docker.pkg.coding.net/gocrane/crane/crane-agent \
--set craneAgent.image.tag=pr-681-ed6727e \
--set cranedDashboard.image.repository=finops-docker.pkg.coding.net/gocrane/crane/dashboard \
--set cranedDashboard.image.tag=pr-681-ed6727e crane/crane Ghcr RegistryOverview: 8000 https://github.com/orgs/gocrane/packages?repo_name=crane
Quick Deploy - Helm helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace \
--set craned.image.repository=ghcr.io/gocrane/crane/craned \
--set craned.image.tag=pr-681-ed6727e \
--set metricAdapter.image.repository=ghcr.io/gocrane/crane/metric-adapter \
--set metricAdapter.image.tag=pr-681-ed6727e \
--set craneAgent.image.repository=ghcr.io/gocrane/crane/crane-agent \
--set craneAgent.image.tag=pr-681-ed6727e \
--set cranedDashboard.image.repository=ghcr.io/gocrane/crane/dashboard \
--set cranedDashboard.image.tag=pr-681-ed6727e crane/crane |
Signed-off-by: xrmzju <xrmzju@163.com>
6173110
to
ed6727e
Compare
@xieydd @Garrybest PTAL. |
Good job👍. /lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What type of PR is this?
enhancements
What this PR does / why we need it:
Fixes # 680
Which issue(s) this PR fixes:
Fixes # 680
Special notes for your reviewer: