@@ -21,6 +21,9 @@ const (
2121 ReservationTypeCommittedResource ReservationType = "CommittedResourceReservation"
2222 // ReservationTypeFailover is a reservation for failover capacity.
2323 ReservationTypeFailover ReservationType = "FailoverReservation"
24+ // ReservationTypeInFlight is a reservation that blocks capacity for virtual
25+ // machines that are currently being scheduled, to avoid double-booking.
26+ ReservationTypeInFlight ReservationType = "InFlightReservation"
2427)
2528
2629// Label keys for Reservation metadata.
@@ -35,6 +38,7 @@ const (
3538 // Reservation type label values
3639 ReservationTypeLabelCommittedResource = "committed-resource"
3740 ReservationTypeLabelFailover = "failover"
41+ ReservationTypeLabelInFlight = "in-flight"
3842)
3943
4044// Annotation keys for Reservation metadata.
@@ -104,10 +108,30 @@ type FailoverReservationSpec struct {
104108 ResourceGroup string `json:"resourceGroup,omitempty"`
105109}
106110
111+ // InFlightReservationSpec defines the nature and shape of the virtual machine
112+ // that is expected to land on the designated reservation slot. This spec
113+ // carries information needed for the scheduler to produce a valid placement
114+ // for new virtual machines for the duration the virtual machine is still
115+ // in buildup.
116+ type InFlightReservationSpec struct {
117+ // VMID is the OpenStack server uuid from Nova assigned to the virtual
118+ // machine expected to land on this reservation slot.
119+ VMID string `json:"vmID,omitempty"`
120+ // UserID is the identifier of the user who owns the virtual machine.
121+ UserID string `json:"userID,omitempty"`
122+ // ProjectID is the identifier of the project/tenant that owns
123+ // the virtual machine.
124+ ProjectID string `json:"projectID,omitempty"`
125+ // Intent defines which kind of virtual machine lifecycle operation
126+ // triggered the placement of this in-flight reservation.
127+ // +kubebuilder:validation:Optional
128+ Intent SchedulingIntent `json:"intent"`
129+ }
130+
107131// ReservationSpec defines the desired state of Reservation.
108132type ReservationSpec struct {
109133 // Type of reservation.
110- // +kubebuilder:validation:Enum=CommittedResourceReservation;FailoverReservation
134+ // +kubebuilder:validation:Enum=CommittedResourceReservation;FailoverReservation;InFlightReservation
111135 // +kubebuilder:validation:Required
112136 Type ReservationType `json:"type"`
113137
@@ -148,6 +172,10 @@ type ReservationSpec struct {
148172 // Only used when Type is FailoverReservation.
149173 // +kubebuilder:validation:Optional
150174 FailoverReservation * FailoverReservationSpec `json:"failoverReservation,omitempty"`
175+
176+ // InFlightReservation specifies which kind of virtual machine is expected
177+ // to land on the reserved slot. Set when Type is InFlightReservation.
178+ InFlightReservation * InFlightReservationSpec `json:"inFlightReservation,omitempty"`
151179}
152180
153181const (
@@ -189,6 +217,10 @@ type FailoverReservationStatus struct {
189217 AcknowledgedAt * metav1.Time `json:"acknowledgedAt,omitempty"`
190218}
191219
220+ // InFlightReservationStatus defines the status fields specific to
221+ // in-flight reservations.
222+ type InFlightReservationStatus struct {} // No captured state for now.
223+
192224// ReservationStatus defines the observed state of Reservation.
193225type ReservationStatus struct {
194226 // The current status conditions of the reservation.
@@ -219,6 +251,11 @@ type ReservationStatus struct {
219251 // Only used when Type is FailoverReservation.
220252 // +kubebuilder:validation:Optional
221253 FailoverReservation * FailoverReservationStatus `json:"failoverReservation,omitempty"`
254+
255+ // InFlightReservation contains status fields specific to in-flight reservations.
256+ // Only used when Type is InFlightReservation.
257+ // +kubebuilder:validation:Optional
258+ InFlightReservation * InFlightReservationStatus `json:"inFlightReservation,omitempty"`
222259}
223260
224261// +kubebuilder:object:root=true
0 commit comments