From e4de599ff886f73d0bf012f205a2e0ebffcf3b26 Mon Sep 17 00:00:00 2001 From: Mykola Dzham Date: Sun, 5 Sep 2021 13:11:25 +0000 Subject: [PATCH] Allow writing 'null' for HardwareRAIDVolumes and SoftwareRAIDVolumes. BuildRAIDCleanSteps and saveHostProvisioningSettings rely on distinguishing between empty/missing and []. --- apis/metal3.io/v1alpha1/baremetalhost_types.go | 2 ++ config/crd/bases/metal3.io_baremetalhosts.yaml | 4 ++++ config/render/capm3.yaml | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/apis/metal3.io/v1alpha1/baremetalhost_types.go b/apis/metal3.io/v1alpha1/baremetalhost_types.go index fd206aa3b7..a9863c8334 100644 --- a/apis/metal3.io/v1alpha1/baremetalhost_types.go +++ b/apis/metal3.io/v1alpha1/baremetalhost_types.go @@ -278,6 +278,7 @@ type RAIDConfig struct { // The list of logical disks for hardware RAID, if rootDeviceHints isn't used, first volume is root volume. // You can set the value of this field to `[]` to clear all the hardware RAID configurations. // +optional + // +nullable HardwareRAIDVolumes []HardwareRAIDVolume `json:"hardwareRAIDVolumes"` // The list of logical disks for software RAID, if rootDeviceHints isn't used, first volume is root volume. @@ -290,6 +291,7 @@ type RAIDConfig struct { // Software RAID will always be deleted. // +kubebuilder:validation:MaxItems=2 // +optional + // +nullable SoftwareRAIDVolumes []SoftwareRAIDVolume `json:"softwareRAIDVolumes"` } diff --git a/config/crd/bases/metal3.io_baremetalhosts.yaml b/config/crd/bases/metal3.io_baremetalhosts.yaml index a6b66f4c18..8a7b0f9c72 100644 --- a/config/crd/bases/metal3.io_baremetalhosts.yaml +++ b/config/crd/bases/metal3.io_baremetalhosts.yaml @@ -316,6 +316,7 @@ spec: required: - level type: object + nullable: true type: array softwareRAIDVolumes: description: The list of logical disks for software RAID, if rootDeviceHints @@ -403,6 +404,7 @@ spec: - level type: object maxItems: 2 + nullable: true type: array type: object rootDeviceHints: @@ -903,6 +905,7 @@ spec: required: - level type: object + nullable: true type: array softwareRAIDVolumes: description: The list of logical disks for software RAID, @@ -992,6 +995,7 @@ spec: - level type: object maxItems: 2 + nullable: true type: array type: object rootDeviceHints: diff --git a/config/render/capm3.yaml b/config/render/capm3.yaml index 2deabba153..d6637ae61e 100644 --- a/config/render/capm3.yaml +++ b/config/render/capm3.yaml @@ -314,6 +314,7 @@ spec: required: - level type: object + nullable: true type: array softwareRAIDVolumes: description: The list of logical disks for software RAID, if rootDeviceHints @@ -401,6 +402,7 @@ spec: - level type: object maxItems: 2 + nullable: true type: array type: object rootDeviceHints: @@ -901,6 +903,7 @@ spec: required: - level type: object + nullable: true type: array softwareRAIDVolumes: description: The list of logical disks for software RAID, @@ -990,6 +993,7 @@ spec: - level type: object maxItems: 2 + nullable: true type: array type: object rootDeviceHints: