plugins

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: Apache-2.0 Imports: 10 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
}

Fitler 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
}

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
	// Set is to set the placement for the current scheduling.
	Description() string
	// RequeueAfter returns the requeue time interval of the placement
	RequeueAfter(ctx context.Context, placement *clusterapiv1beta1.Placement) PluginRequeueResult
}

Plugin is the parent type for all the scheduling plugins.

type PluginFilterResult added in v0.4.0

type PluginFilterResult struct {
	// Filtered contains the filtered ManagedCluster.
	Filtered []*clusterapiv1.ManagedCluster
	// Err contains the filter plugin error message.
	Err error
}

PluginFilterResult contains the details of a filter plugin result.

type PluginRequeueResult added in v0.4.0

type PluginRequeueResult struct {
	// RequeueTime contains the expect requeue time.
	RequeueTime *time.Time
	// Reasons contains the message about requeueTime generation.
	Reasons []string
	// Err contains the plugin requeue error message.
	Err error
}

PluginRequeueResult contains the requeue result of a placement.

type PluginScoreResult added in v0.4.0

type PluginScoreResult struct {
	// Scores contains the ManagedCluster scores.
	Scores map[string]int64
	// Err contains the score plugin error message.
	Err error
}

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
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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