net, tests, infra: Make localnet_vm affinity configurable via parameter#4638
net, tests, infra: Make localnet_vm affinity configurable via parameter#4638Anatw wants to merge 1 commit intoRedHatQE:mainfrom
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughPod anti-affinity construction documents namespace-scoping and now sets ChangesAffinity implementation
Spec dataclass
Localnet tests & fixtures
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Review rate limit: 0/1 reviews remaining, refill in 24 minutes and 42 seconds.Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
|
@coderabbitai the commit message does not comply with |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 4695 🏁 Script executed: Length of output: 7457
The ViolationThe commit uses the wrong trailer keyword: The policy on Why It Wasn't Detected — Two Root Causes1. The code_guidelines:
enabled: true
filePatterns:
- "AGENTS.md"However, 2. No commit-message validation rule in The Recommended FixesTo prevent this class of miss going forward, two changes to a) Add a commit message validation rule to reviews:
instructions: |
## Commit Message Validation
For every commit in this PR, check the commit message trailers:
- If the commit was AI-assisted, the commit MUST include an `Assisted-by:` trailer
in the format: `Assisted-by: <Model Name> <noreply@anthropic.com>` (or equivalent provider).
- `Co-Authored-By:` with an AI model address is NOT compliant — flag it as HIGH severity
and ask the author to replace it with `Assisted-by:`.
- All commits MUST include a `Signed-off-by:` trailer.
...b) Ensure 🧠 Learnings used |
7dbbb66 to
66a5b77
Compare
ea5c54d to
af91aa1
Compare
|
Changes - according to CR comments:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/network/localnet/liblocalnet.py`:
- Around line 143-144: The current assignment vmi_spec.affinity = affinity
attaches the shared mutable LOCALNET_VM_ANTI_AFFINITY instance by reference
(used by localnet fixtures), causing mutations to leak across VMs; fix it by
making a deep copy of the incoming affinity before attaching it to vmi_spec
(e.g., use copy.deepcopy) so vmi_spec.affinity gets an independent nested
dataclass tree; update the code around the affinity parameter handling in
liblocalnet.py where vmi_spec.affinity is set and ensure copy is
imported/available.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: a305a2f5-b2ce-4aab-85de-5a51aec6160d
📒 Files selected for processing (5)
libs/vm/affinity.pylibs/vm/spec.pytests/network/localnet/conftest.pytests/network/localnet/ipam/conftest.pytests/network/localnet/liblocalnet.py
Previously, localnet_vm always applied pod anti-affinity with cross-namespace
selector. This prevented customization for scenarios like stuntime tests that
need VMs to co-locate initially.
Following the network_data pattern, callers now pass the Affinity structure
they need, or None for no affinity constraints.
The new_pod_anti_affinity helper now sets namespaceSelector={} automatically,
eliminating the need for manual configuration after construction.
podAntiAffinity is optional fields in the Affinity class to match
Kubernetes semantics.
Signed-off-by: Anat Wax <awax@redhat.com>
Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
af91aa1 to
33e0d06
Compare
|
Change - according to CodeRabbit review: |
Short description:
Make VM affinity configurable instead of hardcoded for localnet tests.
More details:
Previously, all localnet VMs were forced to use anti-affinity scheduling with cross-namespace selector. This prevented customization for scenarios like stuntime tests that need VMs to co-locate initially before migration.
Following the same pattern used for network configuration, callers now specify the affinity constraints they need, or none if unconstrained scheduling is acceptable.
Cross-namespace affinity is now configured automatically, eliminating repetitive setup code.
Affinity structure now matches Kubernetes semantics—resources can have anti-affinity, affinity, both, or neither.
What this PR does / why we need it:
Which issue(s) this PR fixes:
Addresses code review feedback from #4568.
Special notes for reviewer:
jira-ticket:
Summary by CodeRabbit
New Features
Documentation
Tests