plugins

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxClusterScore is the maximum score a Prioritizer plugin is expected to return.
	MaxClusterScore int64 = 100

	// MinClusterScore is the minimum score a Prioritizer plugin is expected to return.
	MinClusterScore int64 = -100

	// MaxTotalScore is the maximum total score.
	MaxTotalScore int64 = math.MaxInt64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter interface {
	Plugin

	// Filter returns a list of clusters satisfying the certain condition.
	Filter(ctx context.Context, placement *clusterapiv1beta1.Placement, clusters []*clusterapiv1.ManagedCluster) (PluginFilterResult, *framework.Status)
}

Filter defines a filter plugin that filter unsatisfied cluster.

type Handle

type Handle interface {
	// DecisionLister lists all decisions
	DecisionLister() clusterlisterv1beta1.PlacementDecisionLister

	// ScoreLister lists all AddOnPlacementScores
	ScoreLister() clusterlisterv1alpha1.AddOnPlacementScoreLister

	// ClusterLister lists all ManagedClusters
	ClusterLister() clusterlisterv1.ManagedClusterLister

	// ClusterClient returns the cluster client
	ClusterClient() clusterclient.Interface

	// EventRecorder returns an event recorder.
	EventRecorder() events.EventRecorder

	// MetricsRecorder record the metrics for plugins
	MetricsRecorder() *metrics.ScheduleMetrics
}

Handle provides data and some tools that plugins can use. It is passed to the plugin factories at the time of plugin initialization.

type Plugin

type Plugin interface {
	Name() string
	// Description of the plugin
	Description() string
	// RequeueAfter returns the requeue time interval of the placement
	RequeueAfter(ctx context.Context, placement *clusterapiv1beta1.Placement) (PluginRequeueResult, *framework.Status)
}

Plugin is the parent type for all the scheduling plugins.

type PluginFilterResult

type PluginFilterResult struct {
	// Filtered contains the filtered ManagedCluster.
	Filtered []*clusterapiv1.ManagedCluster
}

PluginFilterResult contains the details of a filter plugin result.

type PluginRequeueResult

type PluginRequeueResult struct {
	// RequeueTime contains the expect requeue time.
	RequeueTime *time.Time
}

PluginRequeueResult contains the requeue result of a placement.

type PluginScoreResult

type PluginScoreResult struct {
	// Scores contains the ManagedCluster scores.
	Scores map[string]int64
}

PluginScoreResult contains the details of a score plugin result.

type Prioritizer

type Prioritizer interface {
	Plugin

	// Score gives the score to a list of the clusters, it returns a map with the key as
	// the cluster name.
	Score(ctx context.Context, placement *clusterapiv1beta1.Placement, clusters []*clusterapiv1.ManagedCluster) (PluginScoreResult, *framework.Status)
}

Prioritizer defines a prioritizer plugin that score each cluster. The score is normalized as a floating between 0 and 1.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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