Skip to content

Commit

Permalink
apis/vmware: add VSphereCluster.spec.placement.workerAntiAffinity.mode
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Feb 20, 2025
1 parent 092907a commit bf1d3d3
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
31 changes: 31 additions & 0 deletions apis/vmware/v1beta1/vspherecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,39 @@ const (
type VSphereClusterSpec struct {
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
// placement allows to configure the placement of machines of a VSphereCluster.
Placement VSphereClusterPlacement `json:"placement,omitempty"`
}

// VSphereClusterPlacement defines a placement strategy for machines of a VSphereCluster.
type VSphereClusterPlacement struct {
// workerAntiAffinity configures soft anti-affinity for workers.
WorkerAntiAffinity VSphereClusterWorkerAntiAffinity `json:"workerAntiAffinity,omitempty"`
}

// VSphereClusterWorkerAntiAffinity defines the anti-affinity configuration for workers.
type VSphereClusterWorkerAntiAffinity struct {
// mode allows to set the grouping of (soft) anti-affinity for worker nodes.
// Defaults to `Cluster`.
// +kubebuilder:validation:Enum=Cluster;None;MachineDeployment
// +default:value="Cluster"
Mode VSphereClusterWorkerAntiAffinityMode `json:"mode"`
}

// VSphereClusterWorkerAntiAffinityMode describes the soft anti-affinity mode used across a for distributing virtual machines.
type VSphereClusterWorkerAntiAffinityMode string

const (
// VSphereClusterWorkerAntiAffinityModeCluster means to use all workers as a single group for soft anti-affinity.
VSphereClusterWorkerAntiAffinityModeCluster VSphereClusterWorkerAntiAffinityMode = "Cluster"

// VSphereClusterWorkerAntiAffinityModeNone means to not configure any soft anti-affinity for workers.
VSphereClusterWorkerAntiAffinityModeNone VSphereClusterWorkerAntiAffinityMode = "None"

// VSphereClusterWorkerAntiAffinityModeMachineDeployment means to configure soft anti-affinity for all workers per MachineDeployment.
VSphereClusterWorkerAntiAffinityModeMachineDeployment VSphereClusterWorkerAntiAffinityMode = "MachineDeployment"
)

// VSphereClusterStatus defines the observed state of VSphereClusterSpec.
type VSphereClusterStatus struct {
// Ready indicates the infrastructure required to deploy this cluster is
Expand Down
32 changes: 32 additions & 0 deletions apis/vmware/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 @@ -55,6 +55,28 @@ spec:
- host
- port
type: object
placement:
description: placement allows to configure the placement of machines
of a VSphereCluster.
properties:
workerAntiAffinity:
description: workerAntiAffinity configures soft anti-affinity
for workers.
properties:
mode:
default: Cluster
description: |-
mode allows to set the grouping of (soft) anti-affinity for worker nodes.
Defaults to `Cluster`.
enum:
- Cluster
- None
- MachineDeployment
type: string
required:
- mode
type: object
type: object
type: object
status:
description: VSphereClusterStatus defines the observed state of VSphereClusterSpec.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@ spec:
- host
- port
type: object
placement:
description: placement allows to configure the placement of
machines of a VSphereCluster.
properties:
workerAntiAffinity:
description: workerAntiAffinity configures soft anti-affinity
for workers.
properties:
mode:
default: Cluster
description: |-
mode allows to set the grouping of (soft) anti-affinity for worker nodes.
Defaults to `Cluster`.
enum:
- Cluster
- None
- MachineDeployment
type: string
required:
- mode
type: object
type: object
type: object
required:
- spec
Expand Down

0 comments on commit bf1d3d3

Please sign in to comment.