[AISOS-2052] CAPO validation webhook rejects OpenStackMachine spec patches during IPI install on OCP 4.22.x#423
Conversation
…ec patches during IPI install Detailed description: - Modified controllers/openstackmachine_controller.go to deep-copy PortOpts slices and fields when converting an OpenStackMachineSpec to an OpenStackServerSpec, preventing in-place mutations of the original machine spec in memory. - Enhanced TestOpenStackMachineSpecToOpenStackServerSpec in controllers/openstackmachine_controller_test.go to assert that the input spec is never mutated post-conversion. Closes: AISOS-2074
…ec patches during IPI install on OCP 4.22.x (openshift/cluster-api-provider-openstack) Auto-committed by Forge container fallback.
…coverage Auto-committed by Forge container fallback.
Auto-committed by Forge container fallback.
|
Hi @forgeSmith-bot. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (3)
WalkthroughThe PR deep-copies provided port specs before conversion, adds a regression test that checks the input spec is unchanged, and records related handoff/review notes in ChangesOpenStackMachine immutability fix
Review and handoff notes
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.forge/handoff.md (1)
44-44: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMinor: Path reference may be environment-specific.
Line 44 references
/workspace/docs/as an absolute path. If this documentation is meant to be shared or persisted, consider using a repository-relative path (e.g.,docs/or./docs/) for portability across different environments and clones.🤖 Prompt for 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. In @.forge/handoff.md at line 44, Replace the absolute path reference in the handoff documentation with a repository-relative path so it works across environments; update the relevant text in the markdown entry that currently points to the docs directory using an absolute `/workspace/...` style path.
🤖 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.
Nitpick comments:
In @.forge/handoff.md:
- Line 44: Replace the absolute path reference in the handoff documentation with
a repository-relative path so it works across environments; update the relevant
text in the markdown entry that currently points to the docs directory using an
absolute `/workspace/...` style path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: c3f681ad-81cb-41a7-a950-727cb404e260
📒 Files selected for processing (3)
.forge/handoff.mdcontrollers/openstackmachine_controller.gocontrollers/openstackmachine_controller_test.go
|
/approve |
ekuris-redhat
left a comment
There was a problem hiding this comment.
Please remove the handoff.md file
|
Forge is addressing PR review feedback now. This status update is informational. |
Auto-committed by Forge container fallback.
Detailed description: - Removed the .forge/ directory and its contents (.forge/handoff.md, .forge/review-comments.md, .forge/review-plan.md) from the Git repository index using git rm -r --cached .forge/. - This ensures these files are untracked and excluded from the PR commits, fully resolving the reviewer's feedback while preserving them locally on disk to maintain task continuity. - No source code or documentation files were changed. - Validated that the project builds cleanly, lints cleanly, and passes all unit tests. Closes: AISOS-2052-review-fix
Auto-committed by Forge container fallback.
Auto-committed by Forge container fallback.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tusharjadhav3302 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Summary
This pull request resolves an issue where the CAPO validation webhook rejects
OpenStackMachinespec patches during OpenShift Container Platform (OCP) 4.22.x IPI install by preventing the CAPO controller from mutating theOpenStackMachinespec in-place during conversion. By performing a deep copy of thePortOptsslice and its individual elements, the originalOpenStackMachinespec remains unmodified in memory. This prevents the CAPI patch helper from sending mutated spec patches that violate strict spec immutability and are rejected by the validating webhook, thereby ensuring stable machine provisioning and successful bootstrap.Changes
Controller logic
controllers/openstackmachine_controller.go: Updated the conversion logic withinopenStackMachineSpecToOpenStackServerSpecto deep-copy thePortsslice and each individualPortOptselement using the autogeneratedDeepCopyIntohelper. This isolates downstream in-place mutations (such as assigned networks, fixed IPs, and security groups) from the original machine spec in memory.Test suite
controllers/openstackmachine_controller_test.go: Enhanced the existing unit test runnerTestOpenStackMachineSpecToOpenStackServerSpecto assert that the inputOpenStackMachineSpecis never mutated post-conversion. The test now clones the input spec prior to conversion and verifies that the pre-call and post-call states are identical usingreflect.DeepEqual.Implementation Notes
DeepCopyIntofunctions found inapi/v1beta1/zz_generated.deepcopy.goto guarantee a deep copy of all elements, slices, and pointers.Testing
TestOpenStackMachineSpecToOpenStackServerSpecto assert immutability of the input specs.make test-capo) and confirmed all tests pass cleanly.golangci-lintand formatting standards with zero issues.Related Tickets
Generated by Forge SDLC Orchestrator
Summary by CodeRabbit
Bug Fixes
Documentation
Chores