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
- func GetNamespacedName(object metav1.Object) string
- func GetRequiredJob(anno map[string]string) []string
- func GetVineyarddNodes(c client.Client, jobLabels map[string]string) ([]string, error)
- func New(client client.Client, config *rest.Config, obj runtime.Object, ...) (framework.Plugin, error)
- type BestEffortStrategy
- func (b *BestEffortStrategy) BuildGetClusterInfoCmd(deploymentName, namespace string) *cobra.Command
- func (b *BestEffortStrategy) BuildLsMetadataCmd(deploymentName, namespace string) *cobra.Command
- func (b *BestEffortStrategy) CaptureLsMetadatasOutput(cmd *cobra.Command) []byte
- func (b *BestEffortStrategy) Compute(rank int) (string, error)
- func (b *BestEffortStrategy) ConvertOutputToObjectInfo(deploymentName, namespace string) error
- func (b *BestEffortStrategy) CreateConfigmapForID(jobname []string, locations map[string][]string, ...) error
- func (b *BestEffortStrategy) GetGlobalObjectsByID(jobNames []string) ([]*v1alpha1.GlobalObject, error)
- func (b *BestEffortStrategy) GetLocalObjectsByID(jobNames []string) ([]*v1alpha1.LocalObject, error)
- func (b *BestEffortStrategy) GetLocalObjectsBySignatures(signatures []string) ([]*v1alpha1.LocalObject, error)
- func (b *BestEffortStrategy) GetLocationsByLocalObject(localObjects []*v1alpha1.LocalObject) map[string][]string
- func (b *BestEffortStrategy) GetObjectInfo(locations map[string][]string, localObjectSum int, replica int) (int, []string)
- func (b *BestEffortStrategy) TrackingChunksByAPI(deploymentName, namespace string) *BestEffortStrategy
- func (b *BestEffortStrategy) TrackingChunksByCRD() *BestEffortStrategy
- type PodRank
- type RoundRobinStrategy
- type Scheduler
- type SchedulerConfig
- type SchedulerStrategy
- type VineyardSchedulerInsideCluster
- type VineyardSchedulerOutsideCluster
- type VineyardScheduling
- func (vs *VineyardScheduling) AddArgoWorkflowScheme() error
- func (vs *VineyardScheduling) GetArgoWorkflowReplicas(name types.NamespacedName, pod *v1.Pod) (int, error)
- func (vs *VineyardScheduling) GetPodRank(pod *v1.Pod, replica int) int
- func (vs *VineyardScheduling) Less(pod1, pod2 *framework.PodInfo) bool
- func (vs *VineyardScheduling) Name() string
- func (vs *VineyardScheduling) NormalizeScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, ...) *framework.Status
- func (vs *VineyardScheduling) Permit(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (*framework.Status, time.Duration)
- func (vs *VineyardScheduling) PostBind(ctx context.Context, _ *framework.CycleState, pod *v1.Pod, nodeName string)
- func (vs *VineyardScheduling) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status)
- func (vs *VineyardScheduling) ScoreExtensions() framework.ScoreExtensions
Constants ¶
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 ¶
GetNamespacedName returns the namespaced name of an kubernetes object.
func GetRequiredJob ¶
GetRequiredJob get all required jobs name that separated by ',' from annotations
func GetVineyarddNodes ¶
GetVineyarddNodes returns all node names of vineyardd pods.
Types ¶
type BestEffortStrategy ¶
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 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.
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 (vs *VineyardSchedulerOutsideCluster) SetWithoutCRD(withoutCRD bool) *VineyardSchedulerOutsideCluster
func (*VineyardSchedulerOutsideCluster) SetupConfig ¶
func (vs *VineyardSchedulerOutsideCluster) SetupConfig() error
SetupConfig setups the scheduler config
type VineyardScheduling ¶
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.