8000 support reserved cpus by xrmzju · Pull Request #681 · gocrane/crane · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 1 commit into from
Feb 9, 2023
Merged

Conversation

xrmzju
Copy link
Contributor
@xrmzju xrmzju commented Jan 17, 2023

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:

@@ -120,6 +120,12 @@ func BuildNodeResourceTopology(sysPath string, kubeletConfig *kubeletconfiginter
nrtBuilder.WithReservedCPUs(getNumReservedCPUs(reserved))
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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 {
Copy link
Member

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

Copy link
Contributor Author

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) {
Copy link
Member

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.

@xrmzju xrmzju force-pushed the upstream/reserve-cpus branch 2 times, most recently from 6651cba to 6173110 Compare February 7, 2023 04:39
@github-actions
Copy link
Contributor
github-actions bot commented Feb 7, 2023

🎉 Successfully Build Images.
Now Support ARM Platforms.
Comment Post Time: 2023-02-07 16:00
Git Version: ed6727e

Docker Registry

Overview: https://hub.docker.com/u/gocrane

Image Pull Command
crane-agent:pr-681-ed6727e docker pull gocrane/crane-agent:pr-681-ed6727e
dashboard:pr-681-ed6727e docker pull gocrane/dashboard:pr-681-ed6727e
metric-adapter:pr-681-ed6727e docker pull gocrane/metric-adapter:pr-681-ed6727e
craned:pr-681-ed6727e docker pull gocrane/craned:pr-681-ed6727e

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 Registry

Overview: https://finops.coding.net/public-artifacts/gocrane/crane/packages

Image Pull Command
crane-agent:pr-681-ed6727e docker pull finops-docker.pkg.coding.net/gocrane/crane/crane-agent:pr-681-ed6727e
dashboard:pr-681-ed6727e docker pull finops-docker.pkg.coding.net/gocrane/crane/dashboard:pr-681-ed6727e
metric-adapter:pr-681-ed6727e docker pull finops-docker.pkg.coding.net/gocrane/crane/metric-adapter:pr-681-ed6727e
craned:pr-681-ed6727e docker pull finops-docker.pkg.coding.net/gocrane/crane/craned:pr-681-ed6727e

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 Registry

Overview: 8000 https://github.com/orgs/gocrane/packages?repo_name=crane

Image Pull Command
crane-agent:pr-681-ed6727e docker pull ghcr.io/gocrane/crane/crane-agent:pr-681-ed6727e
dashboard:pr-681-ed6727e docker pull ghcr.io/gocrane/crane/dashboard:pr-681-ed6727e
metric-adapter:pr-681-ed6727e docker pull ghcr.io/gocrane/crane/metric-adapter:pr-681-ed6727e
craned:pr-681-ed6727e docker pull ghcr.io/gocrane/crane/craned:pr-681-ed6727e

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>
@xrmzju xrmzju force-pushed the upstream/reserve-cpus branch from 6173110 to ed6727e Compare February 7, 2023 07:24
@xrmzju xrmzju requested review from xieydd and Garrybest and removed request for xieydd and Garrybest February 7, 2023 08:13
@xrmzju
Copy link
Contributor Author
xrmzju commented Feb 7, 2023

@xieydd @Garrybest PTAL.

@Garrybest
Copy link
Member

Good job👍.

/lgtm

Copy link
Contributor
@mfanjie mfanjie left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member
@xieydd xieydd left a comment

Choose a reason for hiding this comment

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

LGTM

@mfanjie mfanjie merged commit b578edc into gocrane:main Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0