extender

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Package extender contains types and logic to respond to requests from a Kubernetes http scheduler extender.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKubeClient

func GetKubeClient(kubeConfig string) (kubernetes.Interface, *rest.Config, error)

GetKubeClient returns the kube client interface with its config.

Types

type Args

type Args struct {
	// Pod being scheduled
	Pod v1.Pod
	// List of candidate nodes where the pod can be scheduled; to be populated
	// only if ExtenderConfig.NodeCacheCapable == false
	Nodes *v1.NodeList
	// List of candidate node names where the pod can be scheduled; to be
	// populated only if ExtenderConfig.NodeCacheCapable == true
	NodeNames *[]string
}

Args represents the arguments needed by the extender to Filter/Prioritize nodes for a pod.

type BindingArgs

type BindingArgs struct {
	// PodName is the name of the pod being bound
	PodName string
	// PodNamespace is the namespace of the pod being bound
	PodNamespace string
	// PodUID is the UID of the pod being bound
	PodUID types.UID
	// Node selected by the scheduler
	Node string
}

BindingArgs represents the arguments to an extender for binding a pod to a node.

type BindingResult

type BindingResult struct {
	// Error message indicating failure
	Error string
}

BindingResult stores the result from extender to be sent as response.

type FailedNodesMap

type FailedNodesMap map[string]string

FailedNodesMap is needed by HTTP server response.

type FilterResult

type FilterResult struct {
	// Filtered set of nodes where the pod can be scheduled; to be populated
	// only if ExtenderConfig.NodeCacheCapable == false
	Nodes *v1.NodeList
	// Filtered set of nodes where the pod can be scheduled; to be populated
	// only if ExtenderConfig.NodeCacheCapable == true
	NodeNames *[]string
	// Filtered out nodes where the pod can't be scheduled and the failure messages
	FailedNodes FailedNodesMap
	// Error message indicating failure
	Error string
}

FilterResult stores the result from extender to be sent as response.

type HostPriority

type HostPriority struct {
	// Name of the host
	Host string
	// Score associated with the host
	Score int
}

HostPriority represents the priority of scheduling to a particular host, higher priority is better.

type HostPriorityList

type HostPriorityList []HostPriority

HostPriorityList declares a []HostPriority type.

type Scheduler

type Scheduler interface {
	Bind(w http.ResponseWriter, r *http.Request)
	Prioritize(w http.ResponseWriter, r *http.Request)
	Filter(w http.ResponseWriter, r *http.Request)
}

Scheduler has the capabilities needed to prioritize and filter nodes based on http requests.

type Server

type Server struct {
	Scheduler
}

Server type wraps the implementation of the extender.

func (Server) StartServer

func (m Server) StartServer(port string, certFile string, keyFile string, caFile string, unsafe bool)

StartServer starts the HTTP server needed for the scheduler extender. It registers the handlers and checks for existing telemetry policies.

Jump to

Keyboard shortcuts

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