Skip to content

Commit 3c6373f

Browse files
rikatzneolit123
andauthored
✨ Allow using moid (#3229)
* Allow using MOID on fields * Apply suggestions from code review Co-authored-by: Lubomir I. Ivanov <[email protected]> * Standardize error return on envvar controller * Fix API comment to support moref and moid --------- Co-authored-by: Lubomir I. Ivanov <[email protected]>
1 parent 4278eba commit 3c6373f

File tree

12 files changed

+293
-96
lines changed

12 files changed

+293
-96
lines changed

apis/v1beta1/types.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ const (
9393

9494
// VirtualMachineCloneSpec is information used to clone a virtual machine.
9595
type VirtualMachineCloneSpec struct {
96-
// Template is the name or inventory path of the template used to clone
97-
// the virtual machine.
96+
// Template is the name, inventory path, managed object reference or the managed
97+
// object ID of the template used to clone the virtual machine.
9898
// +kubebuilder:validation:MinLength=1
9999
Template string `json:"template"`
100100

@@ -127,19 +127,19 @@ type VirtualMachineCloneSpec struct {
127127
// +optional
128128
Thumbprint string `json:"thumbprint,omitempty"`
129129

130-
// Datacenter is the name or inventory path of the datacenter in which the
131-
// virtual machine is created/located.
130+
// Datacenter is the name, inventory path, managed object reference or the managed
131+
// object ID of the datacenter in which the virtual machine is created/located.
132132
// Defaults to * which selects the default datacenter.
133133
// +optional
134134
Datacenter string `json:"datacenter,omitempty"`
135135

136-
// Folder is the name or inventory path of the folder in which the
137-
// virtual machine is created/located.
136+
// Folder is the name, inventory path, managed object reference or the managed
137+
// object ID of the folder in which the virtual machine is created/located.
138138
// +optional
139139
Folder string `json:"folder,omitempty"`
140140

141-
// Datastore is the name or inventory path of the datastore in which the
142-
// virtual machine is created/located.
141+
// Datastore is the name, inventory path, managed object reference or the managed
142+
// object ID of the datastore in which the virtual machine is created/located.
143143
// +optional
144144
Datastore string `json:"datastore,omitempty"`
145145

@@ -148,8 +148,8 @@ type VirtualMachineCloneSpec struct {
148148
// +optional
149149
StoragePolicyName string `json:"storagePolicyName,omitempty"`
150150

151-
// ResourcePool is the name or inventory path of the resource pool in which
152-
// the virtual machine is created/located.
151+
// ResourcePool is the name, inventory path, managed object reference or the managed
152+
// object ID in which the virtual machine is created/located.
153153
// +optional
154154
ResourcePool string `json:"resourcePool,omitempty"`
155155

@@ -299,8 +299,8 @@ type NetworkSpec struct {
299299
// NetworkDeviceSpec defines the network configuration for a virtual machine's
300300
// network device.
301301
type NetworkDeviceSpec struct {
302-
// NetworkName is the name of the vSphere network to which the device
303-
// will be connected.
302+
// NetworkName is the name, managed object reference or the managed
303+
// object ID of the vSphere network to which the device will be connected.
304304
NetworkName string `json:"networkName"`
305305

306306
// DeviceName may be used to explicitly assign a name to the network device

config/default/crd/bases/infrastructure.cluster.x-k8s.io_vspheremachines.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -976,14 +976,14 @@ spec:
976976
type: object
977977
datacenter:
978978
description: |-
979-
Datacenter is the name or inventory path of the datacenter in which the
980-
virtual machine is created/located.
979+
Datacenter is the name, inventory path, managed object reference or the managed
980+
object ID of the datacenter in which the virtual machine is created/located.
981981
Defaults to * which selects the default datacenter.
982982
type: string
983983
datastore:
984984
description: |-
985-
Datastore is the name or inventory path of the datastore in which the
986-
virtual machine is created/located.
985+
Datastore is the name, inventory path, managed object reference or the managed
986+
object ID of the datastore in which the virtual machine is created/located.
987987
type: string
988988
diskGiB:
989989
description: |-
@@ -999,8 +999,8 @@ spec:
999999
type: string
10001000
folder:
10011001
description: |-
1002-
Folder is the name or inventory path of the folder in which the
1003-
virtual machine is created/located.
1002+
Folder is the name, inventory path, managed object reference or the managed
1003+
object ID of the folder in which the virtual machine is created/located.
10041004
type: string
10051005
guestSoftPowerOffTimeout:
10061006
description: |-
@@ -1237,8 +1237,8 @@ spec:
12371237
type: array
12381238
networkName:
12391239
description: |-
1240-
NetworkName is the name of the vSphere network to which the device
1241-
will be connected.
1240+
NetworkName is the name, managed object reference or the managed
1241+
object ID of the vSphere network to which the device will be connected.
12421242
type: string
12431243
routes:
12441244
description: Routes is a list of optional, static routes
@@ -1400,8 +1400,8 @@ spec:
14001400
type: string
14011401
resourcePool:
14021402
description: |-
1403-
ResourcePool is the name or inventory path of the resource pool in which
1404-
the virtual machine is created/located.
1403+
ResourcePool is the name, inventory path, managed object reference or the managed
1404+
object ID in which the virtual machine is created/located.
14051405
type: string
14061406
server:
14071407
description: |-
@@ -1428,8 +1428,8 @@ spec:
14281428
type: array
14291429
template:
14301430
description: |-
1431-
Template is the name or inventory path of the template used to clone
1432-
the virtual machine.
1431+
Template is the name, inventory path, managed object reference or the managed
1432+
object ID of the template used to clone the virtual machine.
14331433
minLength: 1
14341434
type: string
14351435
thumbprint:

config/default/crd/bases/infrastructure.cluster.x-k8s.io_vspheremachinetemplates.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -846,14 +846,14 @@ spec:
846846
type: object
847847
datacenter:
848848
description: |-
849-
Datacenter is the name or inventory path of the datacenter in which the
850-
virtual machine is created/located.
849+
Datacenter is the name, inventory path, managed object reference or the managed
850+
object ID of the datacenter in which the virtual machine is created/located.
851851
Defaults to * which selects the default datacenter.
852852
type: string
853853
datastore:
854854
description: |-
855-
Datastore is the name or inventory path of the datastore in which the
856-
virtual machine is created/located.
855+
Datastore is the name, inventory path, managed object reference or the managed
856+
object ID of the datastore in which the virtual machine is created/located.
857857
type: string
858858
diskGiB:
859859
description: |-
@@ -869,8 +869,8 @@ spec:
869869
type: string
870870
folder:
871871
description: |-
872-
Folder is the name or inventory path of the folder in which the
873-
virtual machine is created/located.
872+
Folder is the name, inventory path, managed object reference or the managed
873+
object ID of the folder in which the virtual machine is created/located.
874874
type: string
875875
guestSoftPowerOffTimeout:
876876
description: |-
@@ -1110,8 +1110,8 @@ spec:
11101110
type: array
11111111
networkName:
11121112
description: |-
1113-
NetworkName is the name of the vSphere network to which the device
1114-
will be connected.
1113+
NetworkName is the name, managed object reference or the managed
1114+
object ID of the vSphere network to which the device will be connected.
11151115
type: string
11161116
routes:
11171117
description: Routes is a list of optional, static
@@ -1276,8 +1276,8 @@ spec:
12761276
type: string
12771277
resourcePool:
12781278
description: |-
1279-
ResourcePool is the name or inventory path of the resource pool in which
1280-
the virtual machine is created/located.
1279+
ResourcePool is the name, inventory path, managed object reference or the managed
1280+
object ID in which the virtual machine is created/located.
12811281
type: string
12821282
server:
12831283
description: |-
@@ -1304,8 +1304,8 @@ spec:
13041304
type: array
13051305
template:
13061306
description: |-
1307-
Template is the name or inventory path of the template used to clone
1308-
the virtual machine.
1307+
Template is the name, inventory path, managed object reference or the managed
1308+
object ID of the template used to clone the virtual machine.
13091309
minLength: 1
13101310
type: string
13111311
thumbprint:

config/default/crd/bases/infrastructure.cluster.x-k8s.io_vspherevms.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,14 +1066,14 @@ spec:
10661066
type: object
10671067
datacenter:
10681068
description: |-
1069-
Datacenter is the name or inventory path of the datacenter in which the
1070-
virtual machine is created/located.
1069+
Datacenter is the name, inventory path, managed object reference or the managed
1070+
object ID of the datacenter in which the virtual machine is created/located.
10711071
Defaults to * which selects the default datacenter.
10721072
type: string
10731073
datastore:
10741074
description: |-
1075-
Datastore is the name or inventory path of the datastore in which the
1076-
virtual machine is created/located.
1075+
Datastore is the name, inventory path, managed object reference or the managed
1076+
object ID of the datastore in which the virtual machine is created/located.
10771077
type: string
10781078
diskGiB:
10791079
description: |-
@@ -1084,8 +1084,8 @@ spec:
10841084
type: integer
10851085
folder:
10861086
description: |-
1087-
Folder is the name or inventory path of the folder in which the
1088-
virtual machine is created/located.
1087+
Folder is the name, inventory path, managed object reference or the managed
1088+
object ID of the folder in which the virtual machine is created/located.
10891089
type: string
10901090
guestSoftPowerOffTimeout:
10911091
description: |-
@@ -1322,8 +1322,8 @@ spec:
13221322
type: array
13231323
networkName:
13241324
description: |-
1325-
NetworkName is the name of the vSphere network to which the device
1326-
will be connected.
1325+
NetworkName is the name, managed object reference or the managed
1326+
object ID of the vSphere network to which the device will be connected.
13271327
type: string
13281328
routes:
13291329
description: Routes is a list of optional, static routes
@@ -1480,8 +1480,8 @@ spec:
14801480
type: string
14811481
resourcePool:
14821482
description: |-
1483-
ResourcePool is the name or inventory path of the resource pool in which
1484-
the virtual machine is created/located.
1483+
ResourcePool is the name, inventory path, managed object reference or the managed
1484+
object ID in which the virtual machine is created/located.
14851485
type: string
14861486
server:
14871487
description: |-
@@ -1508,8 +1508,8 @@ spec:
15081508
type: array
15091509
template:
15101510
description: |-
1511-
Template is the name or inventory path of the template used to clone
1512-
the virtual machine.
1511+
Template is the name, inventory path, managed object reference or the managed
1512+
object ID of the template used to clone the virtual machine.
15131513
minLength: 1
15141514
type: string
15151515
thumbprint:

pkg/context/fake/fake_vm_context.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ func newVSphereVM() infrav1.VSphereVM {
5454
ObjectMeta: metav1.ObjectMeta{
5555
Namespace: Namespace,
5656
Name: VSphereVMName,
57-
UID: VSphereVMUUID,
5857
},
5958
Spec: infrav1.VSphereVMSpec{
6059
VirtualMachineCloneSpec: infrav1.VirtualMachineCloneSpec{

0 commit comments

Comments
 (0)