Skip to content

Commit 2880c92

Browse files
authored
Merge pull request #3214 from vr4manta/multi_disk
✨ Add ability to add new data disks to VM during clone process
2 parents fd46b8f + 2c30cb1 commit 2880c92

21 files changed

+784
-17
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ generate-e2e-templates-main: $(KUSTOMIZE) ## Generate test templates for the mai
376376
cp "$(RELEASE_DIR)/main/cluster-template-ignition.yaml" "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/base/cluster-template-ignition.yaml"
377377
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/base" > "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/cluster-template.yaml"
378378
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/hw-upgrade" > "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/cluster-template-hw-upgrade.yaml"
379+
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/multi-disk" > "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/cluster-template-multi-disk.yaml"
379380
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/storage-policy" > "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/cluster-template-storage-policy.yaml"
380381
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/conformance" > "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/cluster-template-conformance.yaml"
381382
# Since CAPI uses different flavor names for KCP and MD remediation using MHC

apis/v1alpha3/vspheremachine_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func (src *VSphereMachine) ConvertTo(dstRaw conversion.Hub) error {
4646
dst.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Network.Devices[i].DHCP6Overrides
4747
dst.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Network.Devices[i].SkipIPAllocation
4848
}
49+
dst.Spec.DataDisks = restored.Spec.DataDisks
4950

5051
return nil
5152
}

apis/v1alpha3/vspheremachinetemplate_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func (src *VSphereMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
4949
dst.Spec.Template.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Template.Spec.Network.Devices[i].DHCP6Overrides
5050
dst.Spec.Template.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Template.Spec.Network.Devices[i].SkipIPAllocation
5151
}
52+
dst.Spec.Template.Spec.DataDisks = restored.Spec.Template.Spec.DataDisks
5253

5354
return nil
5455
}

apis/v1alpha3/vspherevm_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func (src *VSphereVM) ConvertTo(dstRaw conversion.Hub) error {
4646
dst.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Network.Devices[i].DHCP6Overrides
4747
dst.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Network.Devices[i].SkipIPAllocation
4848
}
49+
dst.Spec.DataDisks = restored.Spec.DataDisks
4950

5051
return nil
5152
}

apis/v1alpha3/zz_generated.conversion.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha4/vspheremachine_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func (src *VSphereMachine) ConvertTo(dstRaw conversion.Hub) error {
4646
dst.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Network.Devices[i].DHCP6Overrides
4747
dst.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Network.Devices[i].SkipIPAllocation
4848
}
49+
dst.Spec.DataDisks = restored.Spec.DataDisks
4950

5051
return nil
5152
}

apis/v1alpha4/vspheremachinetemplate_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func (src *VSphereMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
4949
dst.Spec.Template.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Template.Spec.Network.Devices[i].DHCP6Overrides
5050
dst.Spec.Template.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Template.Spec.Network.Devices[i].SkipIPAllocation
5151
}
52+
dst.Spec.Template.Spec.DataDisks = restored.Spec.Template.Spec.DataDisks
5253

5354
return nil
5455
}

apis/v1alpha4/vspherevm_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func (src *VSphereVM) ConvertTo(dstRaw conversion.Hub) error {
4646
dst.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Network.Devices[i].DHCP6Overrides
4747
dst.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Network.Devices[i].SkipIPAllocation
4848
}
49+
dst.Spec.DataDisks = restored.Spec.DataDisks
4950

5051
return nil
5152
}

apis/v1alpha4/zz_generated.conversion.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1beta1/types.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,23 @@ type VirtualMachineCloneSpec struct {
203203
// Check the compatibility with the ESXi version before setting the value.
204204
// +optional
205205
HardwareVersion string `json:"hardwareVersion,omitempty"`
206+
// DataDisks are additional disks to add to the VM that are not part of the VM's OVA template.
207+
// +optional
208+
// +listType=map
209+
// +listMapKey=name
210+
// +kubebuilder:validation:MaxItems=29
211+
DataDisks []VSphereDisk `json:"dataDisks,omitempty"`
212+
}
213+
214+
// VSphereDisk is an additional disk to add to the VM that is not part of the VM OVA template.
215+
type VSphereDisk struct {
216+
// Name is used to identify the disk definition. Name is required and needs to be unique so that it can be used to
217+
// clearly identify purpose of the disk.
218+
// +kubebuilder:validation:Required
219+
Name string `json:"name,omitempty"`
220+
// SizeGiB is the size of the disk in GiB.
221+
// +kubebuilder:validation:Required
222+
SizeGiB int32 `json:"sizeGiB"`
206223
}
207224

208225
// VSphereMachineTemplateResource describes the data needed to create a VSphereMachine from a template.

0 commit comments

Comments
 (0)