Skip to content

Commit

Permalink
Merge pull request #3214 from vr4manta/multi_disk
Browse files Browse the repository at this point in the history
✨ Add ability to add new data disks to VM during clone process
  • Loading branch information
k8s-ci-robot authored Dec 23, 2024
2 parents fd46b8f + 2c30cb1 commit 2880c92
Show file tree
Hide file tree
Showing 21 changed files with 784 additions and 17 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ generate-e2e-templates-main: $(KUSTOMIZE) ## Generate test templates for the mai
cp "$(RELEASE_DIR)/main/cluster-template-ignition.yaml" "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/base/cluster-template-ignition.yaml"
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/base" > "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/cluster-template.yaml"
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/hw-upgrade" > "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/cluster-template-hw-upgrade.yaml"
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/multi-disk" > "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/cluster-template-multi-disk.yaml"
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/storage-policy" > "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/cluster-template-storage-policy.yaml"
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/conformance" > "$(E2E_GOVMOMI_TEMPLATE_DIR)/main/cluster-template-conformance.yaml"
# Since CAPI uses different flavor names for KCP and MD remediation using MHC
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha3/vspheremachine_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (src *VSphereMachine) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Network.Devices[i].DHCP6Overrides
dst.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Network.Devices[i].SkipIPAllocation
}
dst.Spec.DataDisks = restored.Spec.DataDisks

return nil
}
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha3/vspheremachinetemplate_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (src *VSphereMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Template.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Template.Spec.Network.Devices[i].DHCP6Overrides
dst.Spec.Template.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Template.Spec.Network.Devices[i].SkipIPAllocation
}
dst.Spec.Template.Spec.DataDisks = restored.Spec.Template.Spec.DataDisks

return nil
}
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha3/vspherevm_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (src *VSphereVM) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Network.Devices[i].DHCP6Overrides
dst.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Network.Devices[i].SkipIPAllocation
}
dst.Spec.DataDisks = restored.Spec.DataDisks

return nil
}
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha3/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apis/v1alpha4/vspheremachine_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (src *VSphereMachine) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Network.Devices[i].DHCP6Overrides
dst.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Network.Devices[i].SkipIPAllocation
}
dst.Spec.DataDisks = restored.Spec.DataDisks

return nil
}
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha4/vspheremachinetemplate_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (src *VSphereMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Template.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Template.Spec.Network.Devices[i].DHCP6Overrides
dst.Spec.Template.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Template.Spec.Network.Devices[i].SkipIPAllocation
}
dst.Spec.Template.Spec.DataDisks = restored.Spec.Template.Spec.DataDisks

return nil
}
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha4/vspherevm_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (src *VSphereVM) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Network.Devices[i].DHCP6Overrides = restored.Spec.Network.Devices[i].DHCP6Overrides
dst.Spec.Network.Devices[i].SkipIPAllocation = restored.Spec.Network.Devices[i].SkipIPAllocation
}
dst.Spec.DataDisks = restored.Spec.DataDisks

return nil
}
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha4/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions apis/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ type VirtualMachineCloneSpec struct {
// Check the compatibility with the ESXi version before setting the value.
// +optional
HardwareVersion string `json:"hardwareVersion,omitempty"`
// DataDisks are additional disks to add to the VM that are not part of the VM's OVA template.
// +optional
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MaxItems=29
DataDisks []VSphereDisk `json:"dataDisks,omitempty"`
}

// VSphereDisk is an additional disk to add to the VM that is not part of the VM OVA template.
type VSphereDisk struct {
// Name is used to identify the disk definition. Name is required and needs to be unique so that it can be used to
// clearly identify purpose of the disk.
// +kubebuilder:validation:Required
Name string `json:"name,omitempty"`
// SizeGiB is the size of the disk in GiB.
// +kubebuilder:validation:Required
SizeGiB int32 `json:"sizeGiB"`
}

// VSphereMachineTemplateResource describes the data needed to create a VSphereMachine from a template.
Expand Down
20 changes: 20 additions & 0 deletions apis/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,31 @@ spec:
CustomVMXKeys is a dictionary of advanced VMX options that can be set on VM
Defaults to empty map
type: object
dataDisks:
description: DataDisks are additional disks to add to the VM that
are not part of the VM's OVA template.
items:
description: VSphereDisk is an additional disk to add to the VM
that is not part of the VM OVA template.
properties:
name:
description: |-
Name is used to identify the disk definition. Name is required and needs to be unique so that it can be used to
clearly identify purpose of the disk.
type: string
sizeGiB:
description: SizeGiB is the size of the disk in GiB.
format: int32
type: integer
required:
- name
- sizeGiB
type: object
maxItems: 29
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
datacenter:
description: |-
Datacenter is the name, inventory path, managed object reference or the managed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,31 @@ spec:
CustomVMXKeys is a dictionary of advanced VMX options that can be set on VM
Defaults to empty map
type: object
dataDisks:
description: DataDisks are additional disks to add to the
VM that are not part of the VM's OVA template.
items:
description: VSphereDisk is an additional disk to add to
the VM that is not part of the VM OVA template.
properties:
name:
description: |-
Name is used to identify the disk definition. Name is required and needs to be unique so that it can be used to
clearly identify purpose of the disk.
type: string
sizeGiB:
description: SizeGiB is the size of the disk in GiB.
format: int32
type: integer
required:
- name
- sizeGiB
type: object
maxItems: 29
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
datacenter:
description: |-
Datacenter is the name, inventory path, managed object reference or the managed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,31 @@ spec:
CustomVMXKeys is a dictionary of advanced VMX options that can be set on VM
Defaults to empty map
type: object
dataDisks:
description: DataDisks are additional disks to add to the VM that
are not part of the VM's OVA template.
items:
description: VSphereDisk is an additional disk to add to the VM
that is not part of the VM OVA template.
properties:
name:
description: |-
Name is used to identify the disk definition. Name is required and needs to be unique so that it can be used to
clearly identify purpose of the disk.
type: string
sizeGiB:
description: SizeGiB is the size of the disk in GiB.
format: int32
type: integer
required:
- name
- sizeGiB
type: object
maxItems: 29
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
datacenter:
description: |-
Datacenter is the name, inventory path, managed object reference or the managed
Expand Down
Loading

0 comments on commit 2880c92

Please sign in to comment.