Skip to content

Commit 465ee4e

Browse files
committed
Add SchedulerHints to server controller
Add SchedulerHints to server controller NOTE! this change MOVED the ServerGroupRef inside the ServerSchedulerHints
1 parent 433af38 commit 465ee4e

20 files changed

+682
-70
lines changed

api/v1alpha1/server_types.go

Lines changed: 71 additions & 6 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
@@ -181,6 +175,77 @@ type ServerResourceSpec struct {
181175
// +listType=set
182176
// +optional
183177
Tags []ServerTag `json:"tags,omitempty"`
178+
179+
// schedulerHints provides hints to the Nova scheduler for server placement.
180+
// +optional
181+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="schedulerHints is immutable"
182+
SchedulerHints *ServerSchedulerHints `json:"schedulerHints,omitempty"`
183+
}
184+
185+
// ServerSchedulerHints provides hints to the Nova scheduler for server placement.
186+
type ServerSchedulerHints struct {
187+
// serverGroupRef is a reference to a ServerGroup object. The server will be
188+
// scheduled on a host in the specified server group.
189+
// +optional
190+
ServerGroupRef *KubernetesNameRef `json:"serverGroupRef,omitempty"`
191+
192+
// differentHostServerRefs is a list of references to Server objects.
193+
// The server will be scheduled on a different host than all specified servers.
194+
// +listType=set
195+
// +kubebuilder:validation:MaxItems:=64
196+
// +optional
197+
DifferentHostServerRefs []KubernetesNameRef `json:"differentHostServerRefs,omitempty"`
198+
199+
// sameHostServerRefs is a list of references to Server objects.
200+
// The server will be scheduled on the same host as all specified servers.
201+
// +listType=set
202+
// +kubebuilder:validation:MaxItems:=64
203+
// +optional
204+
SameHostServerRefs []KubernetesNameRef `json:"sameHostServerRefs,omitempty"`
205+
206+
// query is a conditional statement that results in compute nodes
207+
// able to host the server.
208+
// +kubebuilder:validation:MaxLength:=1024
209+
// +optional
210+
Query *string `json:"query,omitempty"`
211+
212+
// targetCell is a cell name where the server will be placed.
213+
// +kubebuilder:validation:MaxLength:=255
214+
// +optional
215+
TargetCell *string `json:"targetCell,omitempty"`
216+
217+
// differentCell is a list of cell names where the server should not
218+
// be placed.
219+
// +listType=set
220+
// +kubebuilder:validation:MaxItems:=64
221+
// +kubebuilder:validation:items:MaxLength=1024
222+
// +optional
223+
DifferentCell []string `json:"differentCell,omitempty"`
224+
225+
// buildNearHostIP specifies a subnet of compute nodes to host the server.
226+
// +kubebuilder:validation:MaxLength:=255
227+
// +optional
228+
BuildNearHostIP *string `json:"buildNearHostIP,omitempty"`
229+
230+
// additionalProperties is a map of arbitrary key/value pairs that are
231+
// not validated by Nova.
232+
// +optional
233+
AdditionalProperties map[string]string `json:"additionalProperties,omitempty"`
234+
}
235+
236+
// ServerMetadata represents a key-value pair for server metadata.
237+
type ServerMetadata struct {
238+
// key is the metadata key.
239+
// +kubebuilder:validation:MinLength:=1
240+
// +kubebuilder:validation:MaxLength:=255
241+
// +required
242+
Key string `json:"key,omitempty"`
243+
244+
// value is the metadata value.
245+
// +kubebuilder:validation:MaxLength:=255
246+
// +kubebuilder:validation:MinLength:=1
247+
// +required
248+
Value string `json:"value,omitempty"`
184249
}
185250

186251
// +kubebuilder:validation:MinProperties:=1

api/v1alpha1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)