schedulers

package
v0.0.0-...-19badf1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 32 Imported by: 0

Documentation

Overview

Package schedulers implements the vineyard scheduler plugin.

Package schedulers implements the vineyard scheduler plugin.

Package schedulers implements the vineyard scheduler plugin.

Package schedulers implements the vineyard scheduler plugin.

Package schedulers implements the vineyard scheduler plugin.

Index

Constants

View Source
const (
	// Name is the name of the plugin used in Registry and configurations.
	Name = "Vineyard"
	// Timeout is the default timeout for the scheduler plugin.
	Timeout = 60
	// VineyardSystemNamespace is the default system namespace
	VineyardSystemNamespace = "vineyard-system"
)

Variables

This section is empty.

Functions

func GetNamespacedName

func GetNamespacedName(object metav1.Object) string

GetNamespacedName returns the namespaced name of an kubernetes object.

func GetRequiredJob

func GetRequiredJob(anno map[string]string) []string

GetRequiredJob get all required jobs name that separated by ',' from annotations

func GetVineyarddNodes

func GetVineyarddNodes(c client.Client, jobLabels map[string]string) ([]string, error)

GetVineyarddNodes returns all node names of vineyardd pods.

func New

func New(
	client client.Client,
	config *rest.Config,
	obj runtime.Object,
	handle framework.FrameworkHandle,
) (framework.Plugin, error)

New initializes a vineyard scheduler func New(configuration *runtime.Unknown, handle framework.FrameworkHandle) (framework.Plugin, error) {

Types

type BestEffortStrategy

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

BestEffortStrategy is the best effort strategy.

func NewBestEffortStrategy

func NewBestEffortStrategy(
	client client.Client,
	required []string,
	replica int,
	namespace string,
	ownerReference *[]metav1.OwnerReference,
) *BestEffortStrategy

NewBestEffortStrategy returns a new BestEffortStrategy.

func (*BestEffortStrategy) BuildGetClusterInfoCmd

func (b *BestEffortStrategy) BuildGetClusterInfoCmd(deploymentName, namespace string) *cobra.Command

func (*BestEffortStrategy) BuildLsMetadataCmd

func (b *BestEffortStrategy) BuildLsMetadataCmd(deploymentName, namespace string) *cobra.Command

func (*BestEffortStrategy) CaptureLsMetadatasOutput

func (b *BestEffortStrategy) CaptureLsMetadatasOutput(cmd *cobra.Command) []byte

CaptureCmdOutput captures the output of command

func (*BestEffortStrategy) Compute

func (b *BestEffortStrategy) Compute(rank int) (string, error)

Compute return the target node for the given rank.

func (*BestEffortStrategy) ConvertOutputToObjectInfo

func (b *BestEffortStrategy) ConvertOutputToObjectInfo(deploymentName, namespace string) error

ConvertOutputToObjectInfo converts the output of "vineyardctl ls metadatas" to object info.

func (*BestEffortStrategy) CreateConfigmapForID

func (b *BestEffortStrategy) CreateConfigmapForID(
	jobname []string,
	locations map[string][]string,
	jobGlobalObjectIDs map[string][]string,
) error

CreateConfigmapForID creates a configmap for the object id and the nodes.

func (*BestEffortStrategy) GetGlobalObjectsByID

func (b *BestEffortStrategy) GetGlobalObjectsByID(
	jobNames []string,
) ([]*v1alpha1.GlobalObject, error)

GetGlobalObjectsByID returns the global objects by the given jobname.

func (*BestEffortStrategy) GetLocalObjectsByID

func (b *BestEffortStrategy) GetLocalObjectsByID(
	jobNames []string,
) ([]*v1alpha1.LocalObject, error)

GetLocalObjectsByID returns the local objects by the given jobname.

func (*BestEffortStrategy) GetLocalObjectsBySignatures

func (b *BestEffortStrategy) GetLocalObjectsBySignatures(
	signatures []string,
) ([]*v1alpha1.LocalObject, error)

GetLocalObjectsBySignatures returns the local objects by the given signatures.

func (*BestEffortStrategy) GetLocationsByLocalObject

func (b *BestEffortStrategy) GetLocationsByLocalObject(localObjects []*v1alpha1.LocalObject) map[string][]string

func (*BestEffortStrategy) GetObjectInfo

func (b *BestEffortStrategy) GetObjectInfo(
	locations map[string][]string,
	localObjectSum int,
	replica int,
) (int, []string)

GetObjectInfo returns the local object info including the locations and average number of chunks per node.

func (*BestEffortStrategy) TrackingChunksByAPI

func (b *BestEffortStrategy) TrackingChunksByAPI(deploymentName, namespace string) *BestEffortStrategy

func (*BestEffortStrategy) TrackingChunksByCRD

func (b *BestEffortStrategy) TrackingChunksByCRD() *BestEffortStrategy

type PodRank

type PodRank struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type RoundRobinStrategy

type RoundRobinStrategy struct {
	// contains filtered or unexported fields
}

RoundRobinStrategy is the round robin strategy.

func NewRoundRobinStrategy

func NewRoundRobinStrategy(nodes []string) *RoundRobinStrategy

NewRoundRobinStrategy returns a new RoundRobinStrategy.

func (*RoundRobinStrategy) Compute

func (r *RoundRobinStrategy) Compute(rank int) (string, error)

Compute returns the node by the given rank.

type Scheduler

type Scheduler interface {
	Schedule(interface{}) (interface{}, error)
}

Scheduler is the interface for all vineyard schedulers

type SchedulerConfig

type SchedulerConfig struct {
	Required       []string
	Nodes          []string
	Namespace      string
	OwnerReference *[]metav1.OwnerReference
}

SchedulerConfig is the common configuration for all schedulers

type SchedulerStrategy

type SchedulerStrategy interface {
	// Compute returns the score of each node.
	Compute(interface{}) (interface{}, error)
}

SchedulerStrategy is the interface for all scheduler strategies.

type VineyardSchedulerInsideCluster

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

VineyardSchedulerInsideCluster is the vineyard scheduler inside cluster

func NewVineyardSchedulerInsideCluster

func NewVineyardSchedulerInsideCluster(
	c client.Client,
	pod *v1.Pod,
	rank int,
	replica int,
) *VineyardSchedulerInsideCluster

NewVineyardSchedulerInsideCluster returns a new vineyard scheduler inside cluster

func (*VineyardSchedulerInsideCluster) Schedule

func (vs *VineyardSchedulerInsideCluster) Schedule(nodeName string) (int, error)

Schedule compute the score for the given node

func (*VineyardSchedulerInsideCluster) SetupConfig

func (vs *VineyardSchedulerInsideCluster) SetupConfig() error

SetupConfig setups the scheduler config

type VineyardSchedulerOutsideCluster

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

VineyardSchedulerOutsideCluster is the vineyard scheduler outside cluster

func NewVineyardSchedulerOutsideCluster

func NewVineyardSchedulerOutsideCluster(
	c client.Client,
	annotations map[string]string,
	labels map[string]string,
	namespace string,
	ownerReferences []metav1.OwnerReference,
) *VineyardSchedulerOutsideCluster

NewVineyardSchedulerOutsideCluster returns a new vineyard scheduler outside cluster

func (*VineyardSchedulerOutsideCluster) Schedule

func (vs *VineyardSchedulerOutsideCluster) Schedule(replica int) (string, error)

Schedule reads the replica of workload and returns the scheduler order

func (*VineyardSchedulerOutsideCluster) SetWithoutCRD

func (*VineyardSchedulerOutsideCluster) SetupConfig

func (vs *VineyardSchedulerOutsideCluster) SetupConfig() error

SetupConfig setups the scheduler config

type VineyardScheduling

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

VineyardScheduling is a plugin that schedules pods that requires vineyard objects as inputs.

func (*VineyardScheduling) AddArgoWorkflowScheme

func (vs *VineyardScheduling) AddArgoWorkflowScheme() error

AddArgoWorkflowScheme adds Argo workflow scheme to the existing scheme, if it is not added.

func (*VineyardScheduling) GetArgoWorkflowReplicas

func (vs *VineyardScheduling) GetArgoWorkflowReplicas(name types.NamespacedName, pod *v1.Pod) (int, error)

GetArgoWorkflowReplicas get the replicas of the pod from the argo workflow

func (*VineyardScheduling) GetPodRank

func (vs *VineyardScheduling) GetPodRank(pod *v1.Pod, replica int) int

GetPodRank returns the rank of this pod

func (*VineyardScheduling) Less

func (vs *VineyardScheduling) Less(pod1, pod2 *framework.PodInfo) bool

Less compares the priority of two

func (*VineyardScheduling) Name

func (vs *VineyardScheduling) Name() string

Name returns name of the plugin. It is used in logs, etc.

func (*VineyardScheduling) NormalizeScore

func (vs *VineyardScheduling) NormalizeScore(
	ctx context.Context,
	state *framework.CycleState,
	pod *v1.Pod,
	scores framework.NodeScoreList,
) *framework.Status

NormalizeScore normalizes the score of all nodes for a pod.

func (*VineyardScheduling) Permit

func (vs *VineyardScheduling) Permit(
	ctx context.Context,
	state *framework.CycleState,
	pod *v1.Pod,
	nodeName string,
) (*framework.Status, time.Duration)

Permit only permit runs on the node that has vineyard installed.

func (*VineyardScheduling) PostBind

func (vs *VineyardScheduling) PostBind(
	ctx context.Context,
	_ *framework.CycleState,
	pod *v1.Pod,
	nodeName string,
)

PostBind prints the bind info

func (*VineyardScheduling) Score

func (vs *VineyardScheduling) Score(
	ctx context.Context,
	state *framework.CycleState,
	pod *v1.Pod,
	nodeName string,
) (int64, *framework.Status)

Score compute the score for a pod based on the status of required vineyard objects.

func (*VineyardScheduling) ScoreExtensions

func (vs *VineyardScheduling) ScoreExtensions() framework.ScoreExtensions

ScoreExtensions of the Score plugin.

Jump to

Keyboard shortcuts

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