Skip to content

Commit 24cda28

Browse files
committed
api: Granular server groups
Allow users to (a) specify server groups by name or (b) defer management of server groups to CAPO. Signed-off-by: Stephen Finucane <[email protected]>
1 parent f323b4f commit 24cda28

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed

api/v1alpha7/managed_server_groups.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
Copyright 2023 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha7
18+
19+
// OpenStackIdentityReference is a reference to an infrastructure
20+
// provider identity to be used to provision cluster resources.
21+
type ManagedServerGroups struct {
22+
// Policy defines the policy that should be used for the server group used for all machines.
23+
// This will be ignored if ControlPlanePolicy or WorkerPolicy are set, for the respective machine type,
24+
// or for individual machines with a specific server group requested.
25+
// +kubebuilder:validation:Enum="";affinity;soft-affinity;anti-affinity;soft-anti-affinity
26+
// +optional
27+
Policy string `json:"policy,omitempty"`
28+
29+
// ControlPlanePolicy defines the policy that should be used for the server group used for all control plane machines.
30+
// This will be ignored for individual machines with a specific server group requested.
31+
// +kubebuilder:validation:Enum="";affinity;soft-affinity;anti-affinity;soft-anti-affinity
32+
// +optional
33+
ControlPlanePolicy string `json:"controlPlanePolicy,omitempty"`
34+
35+
// WorkerPolicy defines the policy that should be used for the server group used for all worker machines.
36+
// This will be ignored for individual machines with a specific server group requested.
37+
// +kubebuilder:validation:Enum="";affinity;soft-affinity;anti-affinity;soft-anti-affinity
38+
// +optional
39+
WorkerPolicy string `json:"workerPolicy,omitempty"`
40+
}

api/v1alpha7/openstackcluster_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ type OpenStackClusterSpec struct {
118118
// +optional
119119
ManagedSecurityGroups bool `json:"managedSecurityGroups"`
120120

121+
// ManagedServerGroups determines whether OpenStack server groups for the cluster will be
122+
// managed by the OpenStack provider or whether pre-existing server groups will be
123+
// specified as part of the configuration. This can be overridden on a per-machine basis.
124+
// By default, no server group will be created.
125+
// +optional
126+
ManagedServerGroups *ManagedServerGroups `json:"managedServerGroups"`
127+
121128
// AllowAllInClusterTraffic is only used when managed security groups are in use.
122129
// If set to true, the rules for the managed security groups are configured so that all
123130
// ingress and egress between cluster nodes is permitted, allowing CNIs other than

api/v1alpha7/openstackmachine_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,15 @@ type OpenStackMachineSpec struct {
8787
AdditionalBlockDevices []AdditionalBlockDevice `json:"additionalBlockDevices,omitempty"`
8888

8989
// The server group to assign the machine to
90+
//
91+
// Deprecated: Use serverGroup instead. serverGroupID will be silently ignored if serverGroup is set.
9092
ServerGroupID string `json:"serverGroupID,omitempty"`
9193

94+
// The server group to assign the machine to.
95+
// If specified, this will override the managed server group for the machine if server groups are managed.
96+
// +optional
97+
ServerGroup ServerGroupFilter `json:"serverGroup,omitempty"`
98+
9299
// IdentityRef is a reference to a identity to be used when reconciling this cluster
93100
// +optional
94101
IdentityRef *OpenStackIdentityReference `json:"identityRef,omitempty"`

api/v1alpha7/types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ type AdditionalBlockDevice struct {
215215
Storage BlockDeviceStorage `json:"storage"`
216216
}
217217

218+
type ServerGroupFilter struct {
219+
ID string `json:"id,omitempty"`
220+
Name string `json:"name,omityempty"`
221+
}
222+
218223
// BlockDeviceType defines the type of block device to create.
219224
type BlockDeviceType string
220225

0 commit comments

Comments
 (0)