Skip to content

Commit b92c1c3

Browse files
committed
apis/vmware: add VSphereCluster.spec.placement.workerAntiAffinity.mode
1 parent 092907a commit b92c1c3

4 files changed

+121
-4
lines changed

apis/vmware/v1beta1/vspherecluster_types.go

+35
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,43 @@ const (
3838
type VSphereClusterSpec struct {
3939
// +optional
4040
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
41+
// placement allows to configure the placement of machines of a VSphereCluster.
42+
// +optional
43+
Placement *VSphereClusterPlacement `json:"placement,omitempty"`
44+
}
45+
46+
// VSphereClusterPlacement defines a placement strategy for machines of a VSphereCluster.
47+
// +kubebuilder:validation:MinProperties=1
48+
type VSphereClusterPlacement struct {
49+
// workerAntiAffinity configures soft anti-affinity for workers.
50+
// +optional
51+
WorkerAntiAffinity *VSphereClusterWorkerAntiAffinity `json:"workerAntiAffinity,omitempty"`
52+
}
53+
54+
// VSphereClusterWorkerAntiAffinity defines the anti-affinity configuration for workers.
55+
// +kubebuilder:validation:MinProperties=1
56+
type VSphereClusterWorkerAntiAffinity struct {
57+
// mode allows to set the grouping of (soft) anti-affinity for worker nodes.
58+
// Defaults to `Cluster`.
59+
// +kubebuilder:validation:Enum=Cluster;None;MachineDeployment
60+
// +optional
61+
Mode VSphereClusterWorkerAntiAffinityMode `json:"mode,omitempty"`
4162
}
4263

64+
// VSphereClusterWorkerAntiAffinityMode describes the soft anti-affinity mode used across a for distributing virtual machines.
65+
type VSphereClusterWorkerAntiAffinityMode string
66+
67+
const (
68+
// VSphereClusterWorkerAntiAffinityModeCluster means to use all workers as a single group for soft anti-affinity.
69+
VSphereClusterWorkerAntiAffinityModeCluster VSphereClusterWorkerAntiAffinityMode = "Cluster"
70+
71+
// VSphereClusterWorkerAntiAffinityModeNone means to not configure any soft anti-affinity for workers.
72+
VSphereClusterWorkerAntiAffinityModeNone VSphereClusterWorkerAntiAffinityMode = "None"
73+
74+
// VSphereClusterWorkerAntiAffinityModeMachineDeployment means to configure soft anti-affinity for all workers per MachineDeployment.
75+
VSphereClusterWorkerAntiAffinityModeMachineDeployment VSphereClusterWorkerAntiAffinityMode = "MachineDeployment"
76+
)
77+
4378
// VSphereClusterStatus defines the observed state of VSphereClusterSpec.
4479
type VSphereClusterStatus struct {
4580
// Ready indicates the infrastructure required to deploy this cluster is

apis/vmware/v1beta1/zz_generated.deepcopy.go

+44-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/supervisor/crd/bases/vmware.infrastructure.cluster.x-k8s.io_vsphereclusters.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,27 @@ spec:
5555
- host
5656
- port
5757
type: object
58+
placement:
59+
description: placement allows to configure the placement of machines
60+
of a VSphereCluster.
61+
minProperties: 1
62+
properties:
63+
workerAntiAffinity:
64+
description: workerAntiAffinity configures soft anti-affinity
65+
for workers.
66+
minProperties: 1
67+
properties:
68+
mode:
69+
description: |-
70+
mode allows to set the grouping of (soft) anti-affinity for worker nodes.
71+
Defaults to `Cluster`.
72+
enum:
73+
- Cluster
74+
- None
75+
- MachineDeployment
76+
type: string
77+
type: object
78+
type: object
5879
type: object
5980
status:
6081
description: VSphereClusterStatus defines the observed state of VSphereClusterSpec.

config/supervisor/crd/bases/vmware.infrastructure.cluster.x-k8s.io_vsphereclustertemplates.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,27 @@ spec:
6565
- host
6666
- port
6767
type: object
68+
placement:
69+
description: placement allows to configure the placement of
70+
machines of a VSphereCluster.
71+
minProperties: 1
72+
properties:
73+
workerAntiAffinity:
74+
description: workerAntiAffinity configures soft anti-affinity
75+
for workers.
76+
minProperties: 1
77+
properties:
78+
mode:
79+
description: |-
80+
mode allows to set the grouping of (soft) anti-affinity for worker nodes.
81+
Defaults to `Cluster`.
82+
enum:
83+
- Cluster
84+
- None
85+
- MachineDeployment
86+
type: string
87+
type: object
88+
type: object
6889
type: object
6990
required:
7091
- spec

0 commit comments

Comments
 (0)