nova

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: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HistoryCleanup

func HistoryCleanup(ctx context.Context, client client.Client, conf HistoryCleanupConfig) error

Delete all histories for nova servers that have been deleted.

func NewPipelineWebhook

func NewPipelineWebhook() lib.PipelineAdmissionWebhook

Create a new pipeline admission webhook for the nova scheduling domain, using the known filters, weighers and detectors for validation.

func RunChecks

func RunChecks(ctx context.Context, client client.Client, config ChecksConfig)

Run all checks.

Types

type CandidateGatherer

type CandidateGatherer interface {
	// Gather all placement candidates and mutate the request accordingly.
	MutateWithAllCandidates(ctx context.Context, request *api.ExternalSchedulerRequest) error
}

CandidateGatherer is an interface for gathering placement candidates for a given Nova scheduling request.

type ChecksConfig

type ChecksConfig struct {
	// Secret ref to keystone credentials stored in a k8s secret.
	KeystoneSecretRef corev1.SecretReference `json:"keystoneSecretRef"`
	// Secret ref to SSO credentials stored in a k8s secret, if applicable.
	SSOSecretRef *corev1.SecretReference `json:"ssoSecretRef"`
}

type DeschedulingsCleanup

type DeschedulingsCleanup struct {
	// Client for the kubernetes API.
	client.Client
	// Kubernetes scheme to use for the deschedulings.
	Scheme *runtime.Scheme
}

Removes old deschedulings.

func (*DeschedulingsCleanup) Reconcile

func (r *DeschedulingsCleanup) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*DeschedulingsCleanup) SetupWithManager

func (r *DeschedulingsCleanup) SetupWithManager(mgr ctrl.Manager, mcl *multicluster.Client) error

type DeschedulingsCleanupOnStartup

type DeschedulingsCleanupOnStartup struct{ *DeschedulingsCleanup }

func (*DeschedulingsCleanupOnStartup) Start

Cleanup all old deschedulings on controller startup.

type DeschedulingsExecutor

type DeschedulingsExecutor struct {
	// Client for the kubernetes API.
	client.Client
	// Kubernetes scheme to use for the deschedulings.
	Scheme *runtime.Scheme

	// Nova client to execute the descheduling operations.
	NovaClient NovaClient
	// Configuration for the descheduler.
	Conf DeschedulingsExecutorConfig
}

func (*DeschedulingsExecutor) Reconcile

func (e *DeschedulingsExecutor) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

func (*DeschedulingsExecutor) SetupWithManager

func (s *DeschedulingsExecutor) SetupWithManager(mgr manager.Manager, mcl *multicluster.Client) error

type DeschedulingsExecutorConfig

type DeschedulingsExecutorConfig struct {
	// DisableDeschedulerDryRun disables the dry-run mode of the descheduler, allowing it to execute live-migrations.
	DisableDeschedulerDryRun bool `json:"disableDeschedulerDryRun"`
}

type DetectorCycleBreaker

type DetectorCycleBreaker struct {
	// Nova API to get needed information for cycle detection.
	NovaClient NovaClient
}

func (*DetectorCycleBreaker) Filter

type DetectorPipelineController

type DetectorPipelineController struct {
	// Toolbox shared between all pipeline controllers.
	lib.BasePipelineController[*lib.DetectorPipeline[plugins.VMDetection]]

	// Monitor to pass down to all pipelines.
	Monitor lib.DetectorPipelineMonitor
	// Cycle detector to avoid descheduling loops.
	Breaker lib.DetectorCycleBreaker[plugins.VMDetection]
}

The deschedulings pipeline controller is responsible for periodically running the descheduling pipeline and creating descheduling resources based on the selections made.

Additionally, the controller watches for pipeline and step changes to reconfigure the pipelines as needed.

func (*DetectorPipelineController) CreateDeschedulingsPeriodically

func (c *DetectorPipelineController) CreateDeschedulingsPeriodically(ctx context.Context)

func (*DetectorPipelineController) InitPipeline

The base controller will delegate the pipeline creation down to this method.

func (*DetectorPipelineController) PipelineType

The type of pipeline this controller manages.

func (*DetectorPipelineController) Reconcile

func (*DetectorPipelineController) SetupWithManager

func (c *DetectorPipelineController) SetupWithManager(mgr ctrl.Manager, mcl *multicluster.Client) error

type FilterWeigherPipelineController

type FilterWeigherPipelineController struct {
	// Toolbox shared between all pipeline controllers.
	lib.BasePipelineController[lib.FilterWeigherPipeline[api.ExternalSchedulerRequest]]

	// Monitor to pass down to all pipelines.
	Monitor lib.FilterWeigherPipelineMonitor
	// contains filtered or unexported fields
}

The decision pipeline controller takes decision resources containing a placement request spec and runs the scheduling pipeline to make a decision. This decision is then written back to the decision resource status.

Additionally, the controller watches for pipeline and step changes to reconfigure the pipelines as needed.

func (*FilterWeigherPipelineController) InitPipeline

The base controller will delegate the pipeline creation down to this method.

func (*FilterWeigherPipelineController) PipelineType

The type of pipeline this controller manages.

func (*FilterWeigherPipelineController) ProcessNewDecisionFromAPI

func (c *FilterWeigherPipelineController) ProcessNewDecisionFromAPI(ctx context.Context, decision *v1alpha1.Decision) error

Process the decision from the API. Should create and return the updated decision.

func (*FilterWeigherPipelineController) Reconcile

Callback executed when kubernetes asks to reconcile a decision resource.

func (*FilterWeigherPipelineController) SetupWithManager

type HTTPAPI

type HTTPAPI interface {
	// Bind the server handlers.
	Init(*http.ServeMux)
}

func NewAPI

func NewAPI(config HTTPAPIConfig, delegate HTTPAPIDelegate) HTTPAPI

type HTTPAPIConfig

type HTTPAPIConfig struct {
	// Number of top hosts to shuffle for evacuation requests.
	// Set to 0 or negative to disable shuffling.
	EvacuationShuffleK int `json:"evacuationShuffleK,omitempty"`
	// NovaLimitHostsToRequest, if true, will filter the Nova scheduler response
	// to only include hosts that were in the original request.
	NovaLimitHostsToRequest bool `json:"novaLimitHostsToRequest,omitempty"`
}

Custom configuration for the Nova external scheduler api.

type HTTPAPIDelegate

type HTTPAPIDelegate interface {
	// Process the decision from the API. Should create and return the updated decision.
	ProcessNewDecisionFromAPI(ctx context.Context, decision *v1alpha1.Decision) error
}

type HistoryCleanupConfig

type HistoryCleanupConfig struct {
	// Secret ref to keystone credentials stored in a k8s secret.
	KeystoneSecretRef corev1.SecretReference `json:"keystoneSecretRef"`
	// Secret ref to SSO credentials stored in a k8s secret, if applicable.
	SSOSecretRef *corev1.SecretReference `json:"ssoSecretRef"`
}

type HypervisorOvercommitConfig

type HypervisorOvercommitConfig struct {
	// OvercommitMappings is a list of mappings that map hypervisor traits to
	// overcommit ratios. Note that this list is applied in order, so if there
	// are multiple mappings applying to the same hypervisors, the last mapping
	// in this list will override the previous ones.
	OvercommitMappings []HypervisorOvercommitMapping `json:"overcommitMappings"`
}

HypervisorOvercommitConfig holds the configuration for the HypervisorOvercommitController and is loaded from a configmap that is mounted into the controller pod.

func (*HypervisorOvercommitConfig) Validate

func (c *HypervisorOvercommitConfig) Validate() error

Validate the provided HypervisorOvercommitConfig, returning an error if the config is invalid.

type HypervisorOvercommitController

type HypervisorOvercommitController struct {
	client.Client
	// contains filtered or unexported fields
}

HypervisorOvercommitController is a controller that reconciles on the hypervisor crd and sets desired overcommit ratios based on the hypervisor type.

func (*HypervisorOvercommitController) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.2/pkg/reconcile

For more details about the method shape, read up here: - https://ahmet.im/blog/controller-pitfalls/#reconcile-method-shape

func (*HypervisorOvercommitController) SetupWithManager

func (c *HypervisorOvercommitController) SetupWithManager(mgr ctrl.Manager) (err error)

SetupWithManager sets up the controller with the Manager and a multicluster client. The multicluster client is used to watch for changes in the Hypervisor CRD across all clusters and trigger reconciliations accordingly.

type HypervisorOvercommitMapping

type HypervisorOvercommitMapping struct {
	// Overcommit is the overcommit ratio to set for hypervisors by resource name.
	// Values must be set to something >= 1.0, otherwise the controller will
	// ignore them.
	Overcommit map[hv1.ResourceName]float64 `json:"overcommit"`

	// HasTrait specifies a trait that a hypervisor may have, and that, if present,
	// triggers the controller to set the overcommit ratio specified in the
	// overcommit field for that hypervisor.
	HasTrait *string `json:"hasTrait,omitempty"`

	// HasntTrait specifies a trait that a hypervisor may have, and that, if
	// NOT present, triggers the controller to set the overcommit ratio
	// specified in the overcommit field for that hypervisor.
	HasntTrait *string `json:"hasntTrait,omitempty"`
}

HypervisorOvercommitMapping maps hypervisor types to their desired overcommit ratios. This mapping will be loaded from a configmap that is mounted into the controller pod.

func (*HypervisorOvercommitMapping) Validate

func (m *HypervisorOvercommitMapping) Validate() error

Validate the provided HypervisorOvercommitMapping, returning an error if the mapping is invalid.

type NovaClient

type NovaClient interface {
	// Initialize the Nova API with the Keystone authentication.
	Init(ctx context.Context, client client.Client, conf NovaClientConfig) error
	// Get a server by ID.
	Get(ctx context.Context, id string) (server, error)
	// Live migrate a server to a new host (doesnt wait for it to complete).
	LiveMigrate(ctx context.Context, id string) error
	// Get migrations for a server by ID.
	GetServerMigrations(ctx context.Context, id string) ([]migration, error)
	// List all servers for a project with detailed info.
	ListProjectServers(ctx context.Context, projectID string) ([]ServerDetail, error)
}

func NewNovaClient

func NewNovaClient() NovaClient

type NovaClientConfig

type NovaClientConfig struct {
	// Secret ref to keystone credentials stored in a k8s secret.
	KeystoneSecretRef corev1.SecretReference `json:"keystoneSecretRef"`

	// Secret ref to SSO credentials stored in a k8s secret, if applicable.
	SSOSecretRef *corev1.SecretReference `json:"ssoSecretRef,omitempty"`
}

type ServerDetail

type ServerDetail struct {
	ID               string            `json:"id"`
	Name             string            `json:"name"`
	Status           string            `json:"status"`
	TenantID         string            `json:"tenant_id"`
	Created          string            `json:"created"`
	AvailabilityZone string            `json:"OS-EXT-AZ:availability_zone"`
	Hypervisor       string            `json:"OS-EXT-SRV-ATTR:hypervisor_hostname"`
	FlavorName       string            // Populated from nested flavor.original_name
	FlavorRAM        uint64            // Populated from nested flavor.ram
	FlavorVCPUs      uint64            // Populated from nested flavor.vcpus
	FlavorDisk       uint64            // Populated from nested flavor.disk
	Metadata         map[string]string // Server metadata key-value pairs
	Tags             []string          // Server tags
	OSType           string            // OS type determined by OSTypeProber
}

ServerDetail contains extended server information for usage reporting.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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