-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not encode empty hardwareRAIDVolumes #962
Conversation
[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.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @levsha. Thanks for your PR. I'm waiting for a metal3-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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/test-infra repository. |
/ok-to-test @levsha Seems that PR could be rebased to include single commit |
6c4edea
to
a88c8ac
Compare
'nil' becomes 'null' after encoding and this does not pass the schema validation that allows arrays only.
a88c8ac
to
89165c1
Compare
/test-integration |
Done. Thanks for pointing out! |
It was removed for a reason though. @Hellcatlk is there any code that is relying on distinguishing between Also there's no reason to think that the SoftwareRAIDVolume wouldn't have the same issue. /hold |
@zaneb yes, it does also effect the softwareRAIDvolume. setting that to an empty array in the bmh spec gets around it. its also effecting the status field
|
BuildRAIDCleanSteps and saveHostProvisioningSettings rely on distinguishing between empty/missing and []. |
Thanks, that's what I thought. This won't work then. I think the only solution is to add a comment like:
to each field. This will cause a change to the CRD. |
I can confirm that marking both fields as 'nullable' helps (and that 'omitempty' does not help - the original error disappears but then BMH just switches between 'ready' <-> 'preparing' forever, never goes to 'provisioning'). |
/close |
@zaneb: Closed this PR. In 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 kubernetes/test-infra repository. |
@levsha: PR needs rebase. 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/test-infra repository. |
hardwareRAIDVolumes is nil in some cases (probably when the platform of a host supports hardware raid but does not have any volumes configured). This translates to "null" in json representation and causes validation error because 'nil' and '[]' is not the same in Go:
Omitting empty values fixes this error.
The field had "omitempty" previously, but it was removed in https://github.com/metal3-io/baremetal-operator/pull/908/files#diff-0f3e356f6156566888fdbc0e7c0fa713ee054933106059fc29f702f8d1a554f2L289