Skip to content

E2E: Fix ovs dynamic pinning, kubelet and mustgather tests - #1565

Open
mrniranjan wants to merge 4 commits into
openshift:mainfrom
mrniranjan:fix_cgroups_test
Open

E2E: Fix ovs dynamic pinning, kubelet and mustgather tests #1565
mrniranjan wants to merge 4 commits into
openshift:mainfrom
mrniranjan:fix_cgroups_test

Conversation

@mrniranjan

@mrniranjan mrniranjan commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Mustgather: Fetch performance profile instead of hard coding

kubelet/annotations:
E2E: annotations. modify existing tests to preserve existing annotations

Earlier when kubelet experimental annotions e2e tests ran , it used
to overwrite any existing annotations. When running on clusters deployed
using ztp, the existing annotations need to be honoured.

Modify the existing tests to honor the existing annotations.

Also skip the tests if architecture is ARM where the annotations
set kublet topology manager to any value other than none

E2E: ovs:

Use systemctl reboot instead of modifying profile

Earlier we used to modify performance profile to trigger reboot
i.e change the topology manager to best-effort. This is problem
when ran on ARM where changing topology manager to best-effort or
any other value other than none causes ARM worker node to get stuck

So instead we now use systemctl reboot to reboot the node

Signed-off-by: Niranjan M.R <mniranja@redhat.com>

Summary by CodeRabbit

  • Bug Fixes
    • Improved must-gather validation to dynamically locate performance-profile component artifacts using the discovered profile name, including HyperShift tuned file matching (-*.yaml).
    • Updated the “Cgroups and affinity” reboot test to confirm the activation artifact remains after a worker node reboot.
    • Refined performance profile restoration so updates are reverted only when the profile’s spec or annotations differ from the initial state.
    • Added ARM-aware behavior by skipping topology manager policy assertions on ARM nodes.
    • Increased kubelet test reliability by re-fetching the active PerformanceProfile before applying and verifying kubelet parameter changes.

@openshift-ci
openshift-ci Bot requested review from Tal-or and ffromani July 18, 2026 11:04
@openshift-ci

openshift-ci Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mrniranjan
Once this PR has been reviewed and has the lgtm label, please assign ffromani for approval. For more information see the Code Review Process.

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

Details 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

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Performance profile end-to-end tests now derive must-gather filenames dynamically, validate activation-file persistence after node reboots, handle ARM-specific kubelet behavior, refresh profiles before tests, and restore profiles when specs or annotations change.

Changes

Performance profile end-to-end tests

Layer / File(s) Summary
Dynamic must-gather validation
test/e2e/performanceprofile/functests/6_mustgather_testing/mustgather.go
Expected paths derive component filenames from the discovered PerformanceProfile name, including the HyperShift tuned-file glob.
Node reboot activation validation
test/e2e/performanceprofile/functests/7_performance_kubelet_node/cgroups.go
The cgroups suite removes profile mutation setup and verifies activation-file persistence after a worker node reboot and readiness transitions.
Kubelet validation and cleanup
test/e2e/performanceprofile/functests/7_performance_kubelet_node/kubelet.go
Kubelet tests refresh profiles and node state, update autosizing and hugepage calculations, skip the topology-manager assertion on ARM, and compare annotations during cleanup.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: ffromani

🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning kubelet.go still indexes workerRTNodes[0]/updatedNodes after MatchingOptionalSelector without len checks, so tests can skip or panic instead of failing. Add non-empty assertions after filtering, and use the filtered node slice for ARM detection and other indexed access.
Microshift Test Compatibility ⚠️ Warning FAIL: the changed e2e tests hit OpenShift-only APIs (config.openshift.io, machineconfiguration.openshift.io, performance.openshift.io) and have no MicroShift skip/tag. Add a MicroShift guard or tag these tests with the relevant [apigroup:...] labels / [Skipped:MicroShift], or restrict them to non-MicroShift CI jobs.
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main E2E test updates across OVS dynamic pinning, kubelet, and must-gather.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The changed Ginkgo titles are static strings; no test title interpolates runtime values or generated names.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No changed test requires distinct nodes or HA-only behavior; node ops target the selected node and don’t assume multiple hosts.
Topology-Aware Scheduling Compatibility ✅ Passed PR only updates e2e test files under test/e2e/...; no deployment manifests, operator code, or controllers were modified, so no topology scheduling constraints are introduced.
Ote Binary Stdout Contract ✅ Passed PASS: The changed files only log via GinkgoWriter/stderr in TestMain and have no stdout prints in init/suite setup; remaining Printlns are inside It blocks.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The touched Ginkgo tests add no IPv4 literals, IPv4-only parsing, localhost assumptions, or public internet calls.
No-Weak-Crypto ✅ Passed Touched code adds no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB or custom crypto, and no secret/token comparisons; changes are test-path and kubelet logic only.
Container-Privileges ✅ Passed No changed file adds privileged/host* settings, SYS_ADMIN, allowPrivilegeEscalation, or explicit root security context; searches in the touched tests were clean.
No-Sensitive-Data-In-Logs ✅ Passed PASS: The patch only adds generic status logs; no passwords, tokens, PII, or hostnames are logged in the changed lines.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/performanceprofile/functests/7_performance_kubelet_node/cgroups.go`:
- Line 23: Update the reboot flow in the test’s main function and the referenced
lines to stop using MachineConfigPool state: remove the machineconfigv1 import,
performanceMCP definition, and MCP lookup. Handle the reboot command’s returned
error, then synchronize by waiting for the node to transition from Ready to
NotReady and back to Ready, using context.Context for cancellation and timeouts
as established by the other reboot tests in this file.

In `@test/e2e/performanceprofile/functests/7_performance_kubelet_node/kubelet.go`:
- Around line 184-187: Validate that cnfNodes contains at least one node
immediately after nodes.GetByLabels succeeds and before the infrastructure.IsARM
call. Use the test’s existing assertion style to fail clearly when the slice is
empty, while preserving the current first-node behavior for non-empty results.
- Around line 246-249: The comparison before reverting the profile ignores
json.Marshal errors and unnecessarily serializes annotations. In the revert
condition, replace the marshaled annotation values with a direct
equality.Semantic.DeepEqual comparison of profile.Annotations and
initialProfile.Annotations, and remove the currentAnnotations and
initialAnnotations declarations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 8cbc0db0-31d5-45a3-bd63-109721523e37

📥 Commits

Reviewing files that changed from the base of the PR and between 19b0d74 and f3b67b3.

📒 Files selected for processing (3)
  • test/e2e/performanceprofile/functests/6_mustgather_testing/mustgather.go
  • test/e2e/performanceprofile/functests/7_performance_kubelet_node/cgroups.go
  • test/e2e/performanceprofile/functests/7_performance_kubelet_node/kubelet.go

Comment thread test/e2e/performanceprofile/functests/7_performance_kubelet_node/cgroups.go Outdated
Comment thread test/e2e/performanceprofile/functests/7_performance_kubelet_node/kubelet.go Outdated
Comment thread test/e2e/performanceprofile/functests/7_performance_kubelet_node/kubelet.go Outdated
@mrniranjan

Copy link
Copy Markdown
Contributor Author

/test e2e-gcp-pao-updating-profile

1 similar comment
@mrniranjan

Copy link
Copy Markdown
Contributor Author

/test e2e-gcp-pao-updating-profile

Comment thread test/e2e/performanceprofile/functests/7_performance_kubelet_node/cgroups.go Outdated
Comment thread test/e2e/performanceprofile/functests/7_performance_kubelet_node/cgroups.go Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/performanceprofile/functests/7_performance_kubelet_node/cgroups.go`:
- Around line 160-166: Update the reboot sequence around nodes.ExecCommand to
derive a bounded timeout context from ctx, execute the reboot command directly
without sh -c, capture the returned error, and log it as a warning because
connection loss is expected. Replace context.TODO() in the activation-file check
with the existing ctx variable, while preserving the readiness waits and
subsequent validation.

In `@test/e2e/performanceprofile/functests/7_performance_kubelet_node/kubelet.go`:
- Around line 234-237: Update the comparison in the profile-revert condition
near currentSpec and spec to use equality.Semantic.DeepEqual directly on
profile.Spec and initialProfile.Spec, matching the existing annotation
comparison. Remove the json.Marshal calls and their ignored error returns while
preserving the revert decision behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 85b1bd70-b3d8-416c-9f97-480d369c1ee5

📥 Commits

Reviewing files that changed from the base of the PR and between 55276e4 and 44ecf76.

📒 Files selected for processing (3)
  • test/e2e/performanceprofile/functests/6_mustgather_testing/mustgather.go
  • test/e2e/performanceprofile/functests/7_performance_kubelet_node/cgroups.go
  • test/e2e/performanceprofile/functests/7_performance_kubelet_node/kubelet.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/performanceprofile/functests/6_mustgather_testing/mustgather.go

Comment thread test/e2e/performanceprofile/functests/7_performance_kubelet_node/kubelet.go Outdated
Earlier we used to modify performance profile to trigger reboot
i.e change the topology manager to best-effort. This is problem
when ran on ARM where changing topology manager to best-effort or
any other value other than none causes ARM worker node to get stuck

So instead we now use systemctl reboot to reboot the node

Signed-off-by: Niranjan M.R <mniranja@redhat.com>
Earlier when kubelet experimental annotions e2e tests ran , it used
to overwrite any existing annotations. When running on clusters deployed
using ztp, the existing annotations need to be honoured.

Modify the existing tests to honor the existing annotations.

Also skip the tests if architecture is ARM where the annotations
set kublet topology manager to any value other than none

Signed-off-by: Niranjan M.R <mniranja@redhat.com>
Instead of using hardcoded performance profile name, fetch
the performance profile name

Signed-off-by: Niranjan M.R <mniranja@redhat.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/performanceprofile/functests/7_performance_kubelet_node/kubelet.go`:
- Around line 87-93: Replace context.TODO() with bounded context.WithTimeout
contexts for every nodes.ExecCommand call in kubelet.go: the autoSizingCmd loop
at lines 87-93, the sibling call at lines 160-162, and the call at lines
241-254. Ensure each operation’s context is cancelled appropriately and
preserves existing command execution and error assertions.
- Around line 44-49: Ensure selected-node validation cannot pass on empty
results: after filtering in kubelet.go lines 44-49, assert workerRTNodes is
non-empty; after filtering in lines 155-158, assert updatedNodes is non-empty;
and in lines 193-201, determine ARM status from workerRTNodes[0] instead of an
unfiltered cnfNodes lookup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fbda7144-43dd-4e92-9fb2-8b1b4742b61c

📥 Commits

Reviewing files that changed from the base of the PR and between 2c6e84d and 62eac14.

📒 Files selected for processing (3)
  • test/e2e/performanceprofile/functests/6_mustgather_testing/mustgather.go
  • test/e2e/performanceprofile/functests/7_performance_kubelet_node/cgroups.go
  • test/e2e/performanceprofile/functests/7_performance_kubelet_node/kubelet.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/e2e/performanceprofile/functests/6_mustgather_testing/mustgather.go
  • test/e2e/performanceprofile/functests/7_performance_kubelet_node/cgroups.go

@mrniranjan

Copy link
Copy Markdown
Contributor Author

/retest

Test 45488 — Multiple kubelet settings

1. Removed broken ps -ef | grep kubelet block —
   systemReserved is in the drop-in config (/etc/openshift/kubelet.conf.d/20-auto-sizing.conf),
   not in kubelet CLI flags or kubelet.conf
2. Added check via drop-in config file —
   reads 20-auto-sizing.conf from the node and verifies it contains 300Mi

Test 45493 — Should not override PAO values

3. Changed annotation values to differ from PAO defaults —
   was setting cpuManagerPolicy: "static" and cpuManagerReconcilePeriod: "5s" (same as what PAO sets, proving nothing).
   Now sets "none" and "10s", and verifies PAO overrides them back to "static" and 5s

Test 45490 — Memory reservation changes

4. Re-fetch nodes after tuning update —
   workerRTNodes was populated in CustomBeforeAll
   with stale node.Status values. Now re-fetches nodes so
   Capacity and Allocatable reflect the updated reservations

5. Account for hugepages in allocatable calculation —
   pre-allocated hugepages are subtracted from allocatable
   memory by the kubelet but included in node capacity.
   Added loop to sum hugepages from node.Status.Capacity and
   subtract from calculated allocatable

Test 45489 — Verify settings are reverted

6. Added WaitForTuningUpdating / WaitForTuningUpdated —
   was missing the wait after reverting the profile,
   causing assertions to run before rollback completed

7. Replaced systemReserved check —
   same as 45488: removed ps -ef approach,
   added drop-in config file check verifying 300Mi is no longer present

8. Fixed nil vs empty slice assertion —
   changed Equal(nil) to BeEmpty() for AllowedUnsafeSysctls,
   since after reverting it's an empty slice ([]string{}), not nil

9. Replaced context.TODO() with ctx —
   all ExecCommand, GetKubeletConfig, and ControlPlaneClient.Get calls
   now use the existing ctx (context.Background()) variable for
   consistent context usage

10. Added non-emptiness checks for node slices —
    workerRTNodes and updatedNodes are now validated after
    MatchingOptionalSelector to prevent out-of-bounds panics

11. Use workerRTNodes for ARM check —
    replaced separate cnfNodes lookup with workerRTNodes[0] to
    ensure the ARM check targets the same filtered node set
    used by the tests

AI Attribution: AIA Human-AI blend, Content edits
Signed-off-by: Niranjan M.R <mniranja@redhat.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Expect(err).ToNot(HaveOccurred())
currentSpec, _ := json.Marshal(profile.Spec)
spec, _ := json.Marshal(initialProfile.Spec)
// revert only if the profile changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if this comment meant to emphasis that only if the spec changes, it's no longer true.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The commit signature already contains AIA, we don't need the:
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

totalKubeMemory := systemReservedResource.MilliValue() + kubeReservedMemoryResource.MilliValue() + evictionMemoryResource.MilliValue()
calculatedAllocatable := totalCapactity - totalKubeMemory

// Pre-allocated hugepages are subtracted from allocatable memory by the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is no way to reserve hugepages on kubelet:
kubernetes/kubernetes#140544

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We are not reserving hugepages through kubelet, Hugepages are being set using Kernel from the parameters defined in Performance profile.
The hugepages here are pre-allocated by the kernel (via the performance profile's hugepages spec, which sets kernel boot parameters like hugepagesz=2M hugepages=N). When the kernel pre-allocates hugepages,

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@mrniranjan: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-pao-updating-profile d032bc4 link true /test e2e-gcp-pao-updating-profile
ci/prow/e2e-hypershift-pao d032bc4 link true /test e2e-hypershift-pao

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

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.

2 participants