planner

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a resource is not found.
	ErrNotFound = errors.New("not-found")

	// ErrNoNodesFound returned when no elible nodes are found for pod.
	ErrNoNodesFound = errors.New("no eligible nodes found")

	// ErrPodNotAssigned returned when a pod has net yet been assigned to
	// a node.
	ErrPodNotAssigned = errors.New("pod-not-assigned")

	// ErrEmptyPriorityList returned when no node scores are found to select a
	// node for the pod.
	ErrEmptyPriorityList = errors.New("empty-priority-list")
)

Functions

This section is empty.

Types

type APIServer

type APIServer struct {
	Listen  string
	Log     logr.Logger
	Planner *PodSetPlanner
	api.UnimplementedSchedulePlannerServer
}

APIServer Structure anchor for the implementation of the telemetry API server.

func (*APIServer) BuildSchedulePlan

func (a *APIServer) BuildSchedulePlan(ctx context.Context,
	in *api.SchedulePlanRequest,
) (*api.SchedulePlanResponse, error)

BuildSchedulePlan builds a schedule plan based on the podset for the namespace.

func (*APIServer) Run

func (a *APIServer) Run() error

Run Processing loop to listen for and dispatch incoming telemetry API requests.

type Options

type Options struct {
	CallTimeout        time.Duration
	Parallelism        int
	UpdateWorkerPeriod time.Duration
}

Options is the configurable set of options for creating planner.

type PodSetPlanner

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

PodSetPlanner stores the info related to podset planning.

func NewPlanner

func NewPlanner(options Options,
	clientset *kubernetes.Clientset,
	plannerClient *client.SchedulePlannerClient,
	log logr.Logger) (*PodSetPlanner, error)

NewPlanner is used to instantate a podset planner.

func (*PodSetPlanner) BuildPlan

func (p *PodSetPlanner) BuildPlan(parentCtx context.Context,
	podSetHandler *podSetHandlerImpl,
	podList []*v1.Pod,
	schedulingMap map[ktypes.NamespacedName]*podPlannerInfo) (map[string]string, error)

BuildPlan builds the plan for podsets with pod to node assignment map.

func (*PodSetPlanner) BuildSchedulePlan

func (p *PodSetPlanner) BuildSchedulePlan(parentCtx context.Context,
	namespace, podSet string,
	scheduledPod string,
	eligibleNodes []string) (map[string]string, error,
)

BuildSchedulePlan builds a schedule plan for the podset and returns an assignment map containing pod to node assignments.

func (*PodSetPlanner) FindNodeLister

func (p *PodSetPlanner) FindNodeLister(node string) (*v1.Node, error)

FindNodeLister finds an node reference from the lister cache.

func (*PodSetPlanner) GetNodeName

func (p *PodSetPlanner) GetNodeName(pod *v1.Pod) (string, error)

GetNodeName returns the nodename for the given pod.

func (*PodSetPlanner) Stop

func (p *PodSetPlanner) Stop()

Stop is used to stop planner.

Jump to

Keyboard shortcuts

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