Skip to content

Commit

Permalink
Adding comments and documentation for the supported versions
Browse files Browse the repository at this point in the history
  • Loading branch information
FarnazBGH authored and Farnaz Babaeian committed Jun 2, 2024
1 parent 148da67 commit 3a9f88c
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions api/v1beta1/cloudstackaffinitygroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const (
type CloudStackAffinityGroupSpec struct {
// Mutually exclusive parameter with AffinityGroupIDs.
// Can be "host affinity", "host anti-affinity", "non-strict host affinity" or "non-strict host anti-affinity". Will create an affinity group per machine set.
// Note: "non-strict host affinity" and "non-strict host anti-affinity" are supported in CS 4.18.x or higher.
// +kubebuilder:validation:Enum=host affinity;host anti-affinity;non-strict host affinity;non-strict host anti-affinity
// +optional
Type string `json:"type,omitempty"`

// Name.
Expand Down
2 changes: 2 additions & 0 deletions api/v1beta1/cloudstackmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ type CloudStackMachineSpec struct {

// Mutually exclusive parameter with AffinityGroupIDs.
// Defaults to `no`. Can be `pro` or `anti`. Will create an affinity group per machine set.
// Note: "soft-pro" and "soft-anti" are supported in CS 4.18.1 or higher.
// +kubebuilder:validation:Enum=no;pro;anti;soft-pro;soft-anti
// +optional
Affinity string `json:"affinity,omitempty"`

Expand Down
3 changes: 3 additions & 0 deletions api/v1beta2/cloudstackaffinitygroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const AffinityGroupFinalizer = "affinitygroup.infrastructure.cluster.x-k8s.io"
type CloudStackAffinityGroupSpec struct {
// Mutually exclusive parameter with AffinityGroupIDs.
// Can be "host affinity", "host anti-affinity", "non-strict host affinity" or "non-strict host anti-affinity". Will create an affinity group per machine set.
// Note: "non-strict host affinity" and "non-strict host anti-affinity" are supported in CS 4.18.x or higher.
// +kubebuilder:validation:Enum=host affinity;host anti-affinity;non-strict host affinity;non-strict host anti-affinity
// +optional
Type string `json:"type,omitempty"`

// Name.
Expand Down
2 changes: 2 additions & 0 deletions api/v1beta2/cloudstackmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ type CloudStackMachineSpec struct {

// Mutually exclusive parameter with AffinityGroupIDs.
// Defaults to `no`. Can be `pro` or `anti`. Will create an affinity group per machine set.
// Note: "soft-pro" and "soft-anti" are supported in CS 4.18.1 or higher.
// +kubebuilder:validation:Enum=no;pro;anti;soft-pro;soft-anti
// +optional
Affinity string `json:"affinity,omitempty"`

Expand Down
3 changes: 3 additions & 0 deletions api/v1beta3/cloudstackaffinitygroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const AffinityGroupFinalizer = "affinitygroup.infrastructure.cluster.x-k8s.io"
type CloudStackAffinityGroupSpec struct {
// Mutually exclusive parameter with AffinityGroupIDs.
// Can be "host affinity", "host anti-affinity", "non-strict host affinity" or "non-strict host anti-affinity". Will create an affinity group per machine set.
// Note: "non-strict host affinity" and "non-strict host anti-affinity" are supported in CS 4.18.x or higher.
// +kubebuilder:validation:Enum=host affinity;host anti-affinity;non-strict host affinity;non-strict host anti-affinity
// +optional
Type string `json:"type,omitempty"`

// Name.
Expand Down
2 changes: 2 additions & 0 deletions api/v1beta3/cloudstackmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ type CloudStackMachineSpec struct {

// Mutually exclusive parameter with AffinityGroupIDs.
// Defaults to `no`. Can be `pro` or `anti`. Will create an affinity group per machine set.
// Note: "soft-pro" and "soft-anti" are supported in CS 4.18.1 or higher.
// +kubebuilder:validation:Enum=no;pro;anti;soft-pro;soft-anti
// +optional
Affinity string `json:"affinity,omitempty"`

Expand Down
6 changes: 5 additions & 1 deletion docs/book/src/clustercloudstack/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,17 @@ To learn how to configure the required network access in order to SSH into the n
The nodes in the MachineDeployment mapped to a corresponding CloudStackMachine can have a specific host affinity or be assigned to affinity groups.
The affinity can either be specified `pro` (host affinity) or `anti` (host anti affinity) in the `CloudStackMachine.spec.affinity` field in the yaml specification and the required affinity groups will be created in CloudStack
If existing affinity groups in CloudStack wish to be used, the group IDs can be passed as a list in the `CloudStackMachine.spec.affinitygroupids` field in the yaml specification
If existing affinity groups in CloudStack wish to be used, the group IDs can be passed as a list in the `CloudStackMachine.spec.affinitygroupids` field in the yaml specification.

With the release of CloudStack version 4.18, the platform now supports both strict and non-strict affinity groups. Affinity can be designated as `soft-pro` (non-strict host affinity) or `soft-anti` (non-strict host anti-affinity) in the CloudStackMachine.spec.affinity field of the YAML specification. These new categories provide flexibility for deployments that may benefit from less stringent affinity rules.

The list of existing affinity groups can be fetched using the cmk cli as follows :
```
cmk list affinitygroups listall=true | jq '.affinitygroup[] | {name, id}'
```

Note: The soft affinity types are only available in CloudStack version **4.18** and later.

### VM Details

These are arbitrary key value pairs which are passed as VM details while deploying the nodes.
Expand Down

0 comments on commit 3a9f88c

Please sign in to comment.