Skip to content

Commit 07105fd

Browse files
authored
Merge pull request #632 from eshulman2/shints
Add SchedulerHints to server controller
2 parents 4292243 + f99e3d5 commit 07105fd

23 files changed

Lines changed: 720 additions & 69 deletions

.github/workflows/e2e.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ jobs:
3939
enable_workaround_docker_io: 'false'
4040
branch: ${{ matrix.openstack_version }}
4141
enabled_services: "openstack-cli-server,neutron-trunk"
42+
conf_overrides: |
43+
[[post-config|/etc/nova/nova.conf]]
44+
[filter_scheduler]
45+
enabled_filters = ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,SameHostFilter,DifferentHostFilter,SimpleCIDRAffinityFilter,JsonFilter
4246
4347
- name: Deploy a Kind Cluster
4448
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # tag=v1.14.0

api/v1alpha1/server_types.go

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,6 @@ type ServerResourceSpec struct {
181181
// +optional
182182
Volumes []ServerVolumeSpec `json:"volumes,omitempty"`
183183

184-
// serverGroupRef is a reference to a ServerGroup object. The server
185-
// will be created in the server group.
186-
// +optional
187-
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="serverGroupRef is immutable"
188-
ServerGroupRef *KubernetesNameRef `json:"serverGroupRef,omitempty"`
189-
190184
// availabilityZone is the availability zone in which to create the server.
191185
// +kubebuilder:validation:MaxLength=255
192186
// +optional
@@ -217,6 +211,11 @@ type ServerResourceSpec struct {
217211
// +optional
218212
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="configDrive is immutable"
219213
ConfigDrive *bool `json:"configDrive,omitempty"`
214+
215+
// schedulerHints provides hints to the Nova scheduler for server placement.
216+
// +optional
217+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="schedulerHints is immutable"
218+
SchedulerHints *ServerSchedulerHints `json:"schedulerHints,omitempty"`
220219
}
221220

222221
// ServerMetadata represents a key-value pair for server metadata.
@@ -234,8 +233,59 @@ type ServerMetadata struct {
234233
Value string `json:"value,omitempty"`
235234
}
236235

237-
// +kubebuilder:validation:MinProperties:=1
236+
// ServerSchedulerHints provides hints to the Nova scheduler for server placement.
237+
type ServerSchedulerHints struct {
238+
// serverGroupRef is a reference to a ServerGroup object. The server will be
239+
// scheduled on a host in the specified server group.
240+
// +optional
241+
ServerGroupRef *KubernetesNameRef `json:"serverGroupRef,omitempty"`
242+
243+
// differentHostServerRefs is a list of references to Server objects.
244+
// The server will be scheduled on a different host than all specified servers.
245+
// +listType=set
246+
// +kubebuilder:validation:MaxItems:=64
247+
// +optional
248+
DifferentHostServerRefs []KubernetesNameRef `json:"differentHostServerRefs,omitempty"`
249+
250+
// sameHostServerRefs is a list of references to Server objects.
251+
// The server will be scheduled on the same host as all specified servers.
252+
// +listType=set
253+
// +kubebuilder:validation:MaxItems:=64
254+
// +optional
255+
SameHostServerRefs []KubernetesNameRef `json:"sameHostServerRefs,omitempty"`
256+
257+
// query is a conditional statement that results in compute nodes
258+
// able to host the server.
259+
// +kubebuilder:validation:MaxLength:=1024
260+
// +optional
261+
Query string `json:"query,omitempty"`
262+
263+
// targetCell is a cell name where the server will be placed.
264+
// +kubebuilder:validation:MaxLength:=255
265+
// +optional
266+
TargetCell string `json:"targetCell,omitempty"`
267+
268+
// differentCell is a list of cell names where the server should not
269+
// be placed.
270+
// +listType=set
271+
// +kubebuilder:validation:MaxItems:=64
272+
// +kubebuilder:validation:items:MaxLength=1024
273+
// +optional
274+
DifferentCell []string `json:"differentCell,omitempty"`
275+
276+
// buildNearHostIP specifies a subnet of compute nodes to host the server.
277+
// The host IP should be provided in an CIDR format like 10.10.10.10/24.
278+
// +optional
279+
BuildNearHostIP *CIDR `json:"buildNearHostIP,omitempty"`
280+
281+
// additionalProperties is a map of arbitrary key/value pairs that are
282+
// not validated by Nova.
283+
// +optional
284+
AdditionalProperties map[string]string `json:"additionalProperties,omitempty"`
285+
}
286+
238287
// +kubebuilder:validation:MaxProperties:=1
288+
// +kubebuilder:validation:MinProperties:=1
239289
type UserDataSpec struct {
240290
// secretRef is a reference to a Secret containing the user data for this server.
241291
// +optional

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 52 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)