Skip to content

Commit 54a3ad6

Browse files
committed
Add SchedulerHints to server controller
- Add SchedulerHints to server controller - enable required nova filters for testing hints NOTE! this change MOVED the ServerGroupRef inside the ServerSchedulerHints
1 parent 93a12a8 commit 54a3ad6

22 files changed

+697
-73
lines changed

.github/workflows/e2e.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ jobs:
3737
enable_workaround_docker_io: 'false'
3838
branch: ${{ matrix.openstack_version }}
3939
enabled_services: "openstack-cli-server"
40+
conf_overrides: |
41+
[[post-config|/etc/nova/nova.conf]]
42+
[filter_scheduler]
43+
enabled_filters = ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,SameHostFilter,DifferentHostFilter,SimpleCIDRAffinityFilter,JsonFilter
4044
4145
- name: Deploy a Kind Cluster
4246
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab

api/v1alpha1/server_types.go

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,6 @@ type ServerResourceSpec struct {
158158
// +optional
159159
Volumes []ServerVolumeSpec `json:"volumes,omitempty"`
160160

161-
// serverGroupRef is a reference to a ServerGroup object. The server
162-
// will be created in the server group.
163-
// +optional
164-
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="serverGroupRef is immutable"
165-
ServerGroupRef *KubernetesNameRef `json:"serverGroupRef,omitempty"`
166-
167161
// availabilityZone is the availability zone in which to create the server.
168162
// +kubebuilder:validation:MaxLength=255
169163
// +optional
@@ -194,6 +188,11 @@ type ServerResourceSpec struct {
194188
// +optional
195189
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="configDrive is immutable"
196190
ConfigDrive *bool `json:"configDrive,omitempty"`
191+
192+
// schedulerHints provides hints to the Nova scheduler for server placement.
193+
// +optional
194+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="schedulerHints is immutable"
195+
SchedulerHints *ServerSchedulerHints `json:"schedulerHints,omitempty"`
197196
}
198197

199198
// ServerMetadata represents a key-value pair for server metadata.
@@ -211,8 +210,60 @@ type ServerMetadata struct {
211210
Value string `json:"value,omitempty"`
212211
}
213212

214-
// +kubebuilder:validation:MinProperties:=1
213+
// ServerSchedulerHints provides hints to the Nova scheduler for server placement.
214+
type ServerSchedulerHints struct {
215+
// serverGroupRef is a reference to a ServerGroup object. The server will be
216+
// scheduled on a host in the specified server group.
217+
// +optional
218+
ServerGroupRef *KubernetesNameRef `json:"serverGroupRef,omitempty"`
219+
220+
// differentHostServerRefs is a list of references to Server objects.
221+
// The server will be scheduled on a different host than all specified servers.
222+
// +listType=set
223+
// +kubebuilder:validation:MaxItems:=64
224+
// +optional
225+
DifferentHostServerRefs []KubernetesNameRef `json:"differentHostServerRefs,omitempty"`
226+
227+
// sameHostServerRefs is a list of references to Server objects.
228+
// The server will be scheduled on the same host as all specified servers.
229+
// +listType=set
230+
// +kubebuilder:validation:MaxItems:=64
231+
// +optional
232+
SameHostServerRefs []KubernetesNameRef `json:"sameHostServerRefs,omitempty"`
233+
234+
// query is a conditional statement that results in compute nodes
235+
// able to host the server.
236+
// +kubebuilder:validation:MaxLength:=1024
237+
// +optional
238+
Query string `json:"query,omitempty"`
239+
240+
// targetCell is a cell name where the server will be placed.
241+
// +kubebuilder:validation:MaxLength:=255
242+
// +optional
243+
TargetCell string `json:"targetCell,omitempty"`
244+
245+
// differentCell is a list of cell names where the server should not
246+
// be placed.
247+
// +listType=set
248+
// +kubebuilder:validation:MaxItems:=64
249+
// +kubebuilder:validation:items:MaxLength=1024
250+
// +optional
251+
DifferentCell []string `json:"differentCell,omitempty"`
252+
253+
// buildNearHostIP specifies a subnet of compute nodes to host the server.
254+
// this should be provided in an ip/cider format like 10.10.10.10/24.
255+
// +kubebuilder:validation:MaxLength:=255
256+
// +optional
257+
BuildNearHostIP string `json:"buildNearHostIP,omitempty"`
258+
259+
// additionalProperties is a map of arbitrary key/value pairs that are
260+
// not validated by Nova.
261+
// +optional
262+
AdditionalProperties map[string]string `json:"additionalProperties,omitempty"`
263+
}
264+
215265
// +kubebuilder:validation:MaxProperties:=1
266+
// +kubebuilder:validation:MinProperties:=1
216267
type UserDataSpec struct {
217268
// secretRef is a reference to a Secret containing the user data for this server.
218269
// +optional

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 47 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/models-schema/zz_generated.openapi.go

Lines changed: 125 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)