reservations

package
v0.0.0-...-0e8ba2f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultHTTPTimeout = 30 * time.Second

DefaultHTTPTimeout is the default timeout for HTTP requests to the scheduler API.

Variables

This section is empty.

Functions

func GlobalRequestIDFromContext

func GlobalRequestIDFromContext(ctx context.Context) string

GlobalRequestIDFromContext retrieves the global request ID from the context. Returns empty string if not set.

func RequestIDFromContext

func RequestIDFromContext(ctx context.Context) string

RequestIDFromContext retrieves the request ID from the context. Returns empty string if not set.

func WithGlobalRequestID

func WithGlobalRequestID(ctx context.Context, id string) context.Context

WithGlobalRequestID returns a new context with the global request ID set. GlobalRequestID identifies the overall reconciliation context.

func WithRequestID

func WithRequestID(ctx context.Context, id string) context.Context

WithRequestID returns a new context with the request ID set. RequestID identifies the specific item being processed (typically VM UUID).

Types

type ContextKey

type ContextKey string

ContextKey is the type for context keys used in request tracking.

const (
	// GlobalRequestIDKey is the context key for the global request ID.
	GlobalRequestIDKey ContextKey = "globalRequestID"
	// RequestIDKey is the context key for the request ID.
	RequestIDKey ContextKey = "requestID"
)

type FlavorGroupKnowledgeClient

type FlavorGroupKnowledgeClient struct {
	client.Client
}

FlavorGroupKnowledgeClient accesses flavor group data from Knowledge CRDs.

func (*FlavorGroupKnowledgeClient) Get

Get retrieves the flavor groups Knowledge CRD and returns it if ready. Returns nil, nil if not ready yet.

func (*FlavorGroupKnowledgeClient) GetAllFlavorGroups

func (c *FlavorGroupKnowledgeClient) GetAllFlavorGroups(ctx context.Context, knowledgeCRD *v1alpha1.Knowledge) (map[string]compute.FlavorGroupFeature, error)

GetAllFlavorGroups returns all flavor groups as a map. If knowledgeCRD is provided, uses it directly. Otherwise fetches the Knowledge CRD.

type Monitor

type Monitor struct {
	// Client for the kubernetes API.
	client.Client
	// contains filtered or unexported fields
}

Monitor for reservations metrics.

func NewMonitor

func NewMonitor(k8sClient client.Client) Monitor

func (*Monitor) Collect

func (m *Monitor) Collect(ch chan<- prometheus.Metric)

Collect the metrics on-demand and send them to Prometheus.

func (*Monitor) Describe

func (m *Monitor) Describe(ch chan<- *prometheus.Desc)

Describe the metrics for Prometheus.

type ScheduleReservationRequest

type ScheduleReservationRequest struct {
	// InstanceUUID is the unique identifier for the reservation (usually the reservation name).
	InstanceUUID string
	// ProjectID is the OpenStack project ID.
	ProjectID string
	// FlavorName is the name of the flavor.
	FlavorName string
	// FlavorExtraSpecs are extra specifications for the flavor.
	FlavorExtraSpecs map[string]string
	// MemoryMB is the memory in MB.
	MemoryMB uint64
	// VCPUs is the number of virtual CPUs.
	VCPUs uint64
	// EligibleHosts is the list of hosts that can be considered for placement.
	EligibleHosts []api.ExternalSchedulerHost
	// IgnoreHosts is a list of hosts to ignore during scheduling.
	// This is used for failover reservations to avoid placing on the same host as the VMs.
	IgnoreHosts []string
	// Pipeline is the name of the pipeline to execute.
	// If empty, the default pipeline will be used.
	Pipeline string
	// AvailabilityZone is the availability zone to schedule in.
	// This is used by the filter_correct_az filter to ensure hosts are in the correct AZ.
	AvailabilityZone string
	// SchedulerHints are hints passed to the scheduler pipeline.
	// Used to set _nova_check_type for evacuation intent detection.
	SchedulerHints map[string]any
}

ScheduleReservationRequest contains the parameters for scheduling a reservation.

type ScheduleReservationResponse

type ScheduleReservationResponse struct {
	// Hosts is the ordered list of hosts that the reservation can be placed on.
	// The first host is the best choice.
	Hosts []string
}

ScheduleReservationResponse contains the result of scheduling a reservation.

type SchedulerClient

type SchedulerClient struct {
	// URL of the external scheduler API.
	URL string
	// HTTP client to use for requests.
	HTTPClient *http.Client
}

SchedulerClient is a client for the external scheduler API. It can be used by both the ReservationReconciler and FailoverReservationController.

func NewSchedulerClient

func NewSchedulerClient(url string) *SchedulerClient

NewSchedulerClient creates a new SchedulerClient with a default timeout.

func (*SchedulerClient) ScheduleReservation

ScheduleReservation calls the external scheduler API to find a host for a reservation. The context should contain GlobalRequestID and RequestID for logging (use WithGlobalRequestID/WithRequestID).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL