OCPBUGS-85509: Add omitempty to vSphere and Nutanix MachinePool slice fields#10551
OCPBUGS-85509: Add omitempty to vSphere and Nutanix MachinePool slice fields#10551chdeshpa-hue wants to merge 1 commit into
Conversation
… fields Add omitempty to optional slice fields (DataDisks, GPUs) in vSphere and Nutanix MachinePool types. Without omitempty, marshaling a zero-valued struct emits dataDisks: null / gpus: null, which older installer payloads treat as unknown fields and emit warnings during cluster provisioning via automation tools (Hive, assisted-service). Azure's DataDisks already carries omitempty; this brings vSphere and Nutanix into alignment. Assisted-by: Codex 5.3 Co-authored-by: Cursor <cursoragent@cursor.com>
|
@chdeshpa-hue: This pull request references Jira Issue OCPBUGS-85509, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin 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 (2)
WalkthroughThe PR makes ChangesMachine Pool DataDisks Optional
🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 12✅ Passed checks (12 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions 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. Comment |
|
Hi @chdeshpa-hue. 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
|
/ok-to-test |
|
/test shellcheck Validating CI job shellcheck, ignore |
|
/test ci/prow/shellcheck |
|
/test shellcheck |
|
@chdeshpa-hue: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
Summary
omitemptyto optional slice fields (DataDisks,GPUs) in vSphere and NutanixMachinePooltypes that were missing itDataDiskswhich already carriesomitemptyProblem
When automation tools (Hive, assisted-service) vendor newer installer types and marshal an
InstallConfigtargeting an older cluster version (e.g., 4.18), the emptyDataDisksslice is serialized asdataDisks: null. The older installer binary does not recognize this field, andUnmarshalStrictemits:The install succeeds (the installer falls back to non-strict unmarshal when
OPENSHIFT_INSTALL_INVOKERis set), but the warning creates customer-facing noise.Fix
Add
omitemptyto 3 fields across 2 files:pkg/types/vsphere/machinepool.goDataDisksjson:"dataDisks"json:"dataDisks,omitempty"pkg/types/nutanix/machinepool.goDataDisksjson:"dataDisks"json:"dataDisks,omitempty"pkg/types/nutanix/machinepool.goGPUsjson:"gpus"json:"gpus,omitempty"This is safe because:
+optionallen() > 0guards before accessing elementslen() == 0), identical to the current empty-slice behaviorMachinePool.Set()methods guard withlen(required.DataDisks) > 0Test plan
go test ./pkg/types/vsphere/... ./pkg/types/nutanix/...)MachinePoolwith noDataDisksno longer emits thedataDiskskeyMachinePoolwith explicitDataDisksstill includes themMade with Cursor
Summary by CodeRabbit