Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion api/v1alpha1/reservation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const (
ReservationTypeCommittedResource ReservationType = "CommittedResourceReservation"
// ReservationTypeFailover is a reservation for failover capacity.
ReservationTypeFailover ReservationType = "FailoverReservation"
// ReservationTypeInFlight is a reservation that blocks capacity for virtual
// machines that are currently being scheduled, to avoid double-booking.
ReservationTypeInFlight ReservationType = "InFlightReservation"
)

// Label keys for Reservation metadata.
Expand All @@ -35,6 +38,7 @@ const (
// Reservation type label values
ReservationTypeLabelCommittedResource = "committed-resource"
ReservationTypeLabelFailover = "failover"
ReservationTypeLabelInFlight = "in-flight"
)

// Annotation keys for Reservation metadata.
Expand Down Expand Up @@ -104,10 +108,30 @@ type FailoverReservationSpec struct {
ResourceGroup string `json:"resourceGroup,omitempty"`
}

// InFlightReservationSpec defines the nature and shape of the virtual machine
// that is expected to land on the designated reservation slot. This spec
// carries information needed for the scheduler to produce a valid placement
// for new virtual machines for the duration the virtual machine is still
// in buildup.
type InFlightReservationSpec struct {
// VMID is the OpenStack server uuid from Nova assigned to the virtual
// machine expected to land on this reservation slot.
VMID string `json:"vmID,omitempty"`
// UserID is the identifier of the user who owns the virtual machine.
UserID string `json:"userID,omitempty"`
// ProjectID is the identifier of the project/tenant that owns
// the virtual machine.
ProjectID string `json:"projectID,omitempty"`
// Intent defines which kind of virtual machine lifecycle operation
// triggered the placement of this in-flight reservation.
// +kubebuilder:validation:Optional
Intent SchedulingIntent `json:"intent"`
}

// ReservationSpec defines the desired state of Reservation.
type ReservationSpec struct {
// Type of reservation.
// +kubebuilder:validation:Enum=CommittedResourceReservation;FailoverReservation
// +kubebuilder:validation:Enum=CommittedResourceReservation;FailoverReservation;InFlightReservation
// +kubebuilder:validation:Required
Type ReservationType `json:"type"`

Expand Down Expand Up @@ -148,6 +172,10 @@ type ReservationSpec struct {
// Only used when Type is FailoverReservation.
// +kubebuilder:validation:Optional
FailoverReservation *FailoverReservationSpec `json:"failoverReservation,omitempty"`

// InFlightReservation specifies which kind of virtual machine is expected
// to land on the reserved slot. Set when Type is InFlightReservation.
InFlightReservation *InFlightReservationSpec `json:"inFlightReservation,omitempty"`
}

const (
Expand Down Expand Up @@ -189,6 +217,10 @@ type FailoverReservationStatus struct {
AcknowledgedAt *metav1.Time `json:"acknowledgedAt,omitempty"`
}

// InFlightReservationStatus defines the status fields specific to
// in-flight reservations.
type InFlightReservationStatus struct{} // No captured state for now.

// ReservationStatus defines the observed state of Reservation.
type ReservationStatus struct {
// The current status conditions of the reservation.
Expand Down Expand Up @@ -219,6 +251,11 @@ type ReservationStatus struct {
// Only used when Type is FailoverReservation.
// +kubebuilder:validation:Optional
FailoverReservation *FailoverReservationStatus `json:"failoverReservation,omitempty"`

// InFlightReservation contains status fields specific to in-flight reservations.
// Only used when Type is InFlightReservation.
// +kubebuilder:validation:Optional
InFlightReservation *InFlightReservationStatus `json:"inFlightReservation,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
40 changes: 40 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions helm/library/cortex/files/crds/cortex.cloud_reservations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,31 @@ spec:
(e.g., "hana_medium_v2").
type: string
type: object
inFlightReservation:
description: |-
InFlightReservation specifies which kind of virtual machine is expected
to land on the reserved slot. Set when Type is InFlightReservation.
properties:
intent:
description: |-
Intent defines which kind of virtual machine lifecycle operation
triggered the placement of this in-flight reservation.
type: string
projectID:
description: |-
ProjectID is the identifier of the project/tenant that owns
the virtual machine.
type: string
userID:
description: UserID is the identifier of the user who owns the
virtual machine.
type: string
vmID:
description: |-
VMID is the OpenStack server uuid from Nova assigned to the virtual
machine expected to land on this reservation slot.
type: string
type: object
resources:
additionalProperties:
anyOf:
Expand Down Expand Up @@ -203,6 +228,7 @@ spec:
enum:
- CommittedResourceReservation
- FailoverReservation
- InFlightReservation
type: string
required:
- type
Expand Down Expand Up @@ -330,6 +356,11 @@ spec:
- For Nova: the hypervisor hostname
- For Pods: the node name
type: string
inFlightReservation:
description: |-
InFlightReservation contains status fields specific to in-flight reservations.
Only used when Type is InFlightReservation.
type: object
type: object
required:
- spec
Expand Down