Skip to content

Conversation

@bitoku
Copy link
Contributor

@bitoku bitoku commented Jul 7, 2025

What type of PR is this?

/kind failing-test

What this PR does / why we need it:

Because of the changes in conversion of cpu.weight in cgroupv2, the InPlacePodVerticalScaling tests no longer pass.

This change enables graceful migration from the old conversion to the new conversion, not to break the CI.

Which issue(s) this PR is related to:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

None

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 7, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @bitoku. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/dependency Issues or PRs related to dependency changes area/test sig/node Categorizes an issue or PR as relevant to SIG Node. labels Jul 7, 2025
@k8s-ci-robot k8s-ci-robot added the sig/testing Categorizes an issue or PR as relevant to SIG Testing. label Jul 7, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Jul 7, 2025
@k8s-ci-robot k8s-ci-robot requested review from a team, dims and logicalhan July 7, 2025 15:50
if podOnCgroupv2 {
// TODO: This fomula should be a shared function.
return 1 + ((shares-2)*9999)/262142
// TODO: Remove the old conversion once container runtimes are updated.
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a link to the oci runtime changes/issues to track why we check both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the description. let me know if anything unclear.

@bitoku bitoku force-pushed the cpu-weight branch 2 times, most recently from 9e7062f to b6d4eda Compare July 7, 2025 16:25
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@giuseppe
Copy link
Member

giuseppe commented Jul 8, 2025

There are other instances of this conversion in the code. Will they be addressed separately?

@bitoku
Copy link
Contributor Author

bitoku commented Jul 8, 2025

@giuseppe I just didn't realize other instances. I'd like to include them in this PR. Can you point out for me?

@giuseppe
Copy link
Member

giuseppe commented Jul 8, 2025

@giuseppe I just didn't realize other instances. I'd like to include them in this PR. Can you point out for me?

these are the ones I see:

➜ git grep 262142
pkg/kubelet/cm/cgroup_manager_linux.go: return 1 + ((*cpuShares-2)*9999)/262142
pkg/kubelet/cm/cgroup_v2_manager_linux.go:      return uint64((((cpuShares - 2) * 9999) / 262142) + 1)
pkg/kubelet/cm/cgroup_v2_manager_linux.go:      return uint64((((cpuWeight - 1) * 262142) / 9999) + 2)
test/e2e/common/node/framework/cgroups/cgroups.go:              return 1 + ((shares-2)*9999)/262142
test/e2e_node/node_container_manager_test.go:   return 1 + ((shares-2)*9999)/262142

most of them are mechanical, except return uint64((((cpuWeight - 1) * 262142) / 9999) + 2) that needs the inverse function

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 29, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 30fca49d6f5e49a116ee1a3ee78a4a3284186a89

@soltysh
Copy link
Contributor

soltysh commented Sep 1, 2025

@bitoku one nit, can you split the commits, such that one is touching go.mod, go.sum and vendor/ directory, and the other one is where you're modifying the test code?

@bitoku
Copy link
Contributor Author

bitoku commented Sep 2, 2025

Hi @soltysh, thanks for the review.
Could you tell me the reason for splitting?

@soltysh
Copy link
Contributor

soltysh commented Sep 3, 2025

Hi @soltysh, thanks for the review. Could you tell me the reason for splitting?

It's easier to review, since the actual code changes are handled manually and require more thorough checks, whereas the automatic vendor changes less so. It's a general practice used in the project to have these two separate. Something similar applies to changes coming from running make update. Although, I will say it's not strictly required 😉

@sohankunkerkar
Copy link
Member

Is there a plan to backport this to 1.33 once it’s merged?

@bitoku
Copy link
Contributor Author

bitoku commented Sep 5, 2025

@sohankunkerkar
I don't think we need to backport it.
It changes only the test. Unless we update crun/runc, the test in 1.33 (and 1.34 too) won't break.

@@ -0,0 +1,50 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

the name implies that this file will have some build directives

Copy link
Contributor Author

@bitoku bitoku Sep 11, 2025

Choose a reason for hiding this comment

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

The file suffix is also respected as a build constraint.
https://pkg.go.dev/go/build#hdr-Build_Constraints

These files don't have one either.

/*
Copyright 2016 The Kubernetes Authors.

/*
Copyright 2015 The Kubernetes Authors.

Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

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

beyond the build directive this LGTM

Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@bitoku
Copy link
Contributor Author

bitoku commented Sep 11, 2025

@liggitt Can you PTAL as dep-approver?


// Resources contains various cgroups settings to apply.
*Resources `json:"Resources,omitempty"`
*Resources
Copy link
Member

Choose a reason for hiding this comment

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

was it intentional to change the serialization upstream? this will now serialize explicit null values... does that impact us in any user-facing way?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe the kubelet serializes this cgroup object at all, it's kept as a go structure AFAIU and not read to or from anything. It's possible CRI implementations do, but this vendor doesn't affect that... we only use it in libctCgroupConfig and in every case it's used it's immediately passed to libctr.New() function

@liggitt
Copy link
Member

liggitt commented Sep 11, 2025

/approve
for dep changes

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bitoku, giuseppe, liggitt, SergeyKanzhelev

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 11, 2025
@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot k8s-ci-robot merged commit 1d80f35 into kubernetes:master Sep 11, 2025
14 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.35 milestone Sep 11, 2025
@github-project-automation github-project-automation bot moved this from Needs Approver to Done in SIG Node: code and documentation PRs Sep 11, 2025
@github-project-automation github-project-automation bot moved this from PRs - Needs Reviewer to Done in SIG Node CI/Test Board Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/dependency Issues or PRs related to dependency changes area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Development

Successfully merging this pull request may close these issues.

9 participants