utils

package
v0.37.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DemandName

func DemandName(pod *v1.Pod) string

DemandName returns a demand name from a pod name

func GetPodFromObjectOrTombstone

func GetPodFromObjectOrTombstone(obj interface{}) (*v1.Pod, bool)

GetPodFromObjectOrTombstone tries to cast the passed object to a Pod object, and if that's not possible tries to get the Pod object from the tombstone

func IsPodTerminated

func IsPodTerminated(pod *v1.Pod) bool

IsPodTerminated returns whether the pod is considered to be terminated

func IsSparkSchedulerDemand

func IsSparkSchedulerDemand(obj interface{}) bool

IsSparkSchedulerDemand returns whether the passed object is a demand created by the spark scheduler extender

func IsSparkSchedulerExecutorPod

func IsSparkSchedulerExecutorPod(obj interface{}) bool

IsSparkSchedulerExecutorPod returns whether the passed object is a spark application pod which has this scheduler in the scheduler spec and is an executor

func IsSparkSchedulerPod

func IsSparkSchedulerPod(obj interface{}) bool

IsSparkSchedulerPod returns whether the passed object is a spark application pod which has this scheduler in the scheduler spec

func ListWithPredicate

func ListWithPredicate(nodeLister corelisters.NodeLister, predicate NodeConditionPredicate) ([]*v1.Node, error)

ListWithPredicate gets nodes that matches predicate function.

func OnDemandFulfilled

func OnDemandFulfilled(ctx context.Context, fn func(*v1alpha2.Demand)) func(interface{}, interface{})

OnDemandFulfilled returns a function that calls the wrapped function if the demand object is fulfilled

func OnPodScheduled

func OnPodScheduled(ctx context.Context, fn func(*v1.Pod)) func(interface{}, interface{})

OnPodScheduled returns a function that calls the wrapped function if the pod is scheduled

func PodName

func PodName(demand *v1alpha2.Demand) string

PodName returns a pod name from a demand name

Types

type NodeConditionPredicate

type NodeConditionPredicate func(node *v1.Node) bool

NodeConditionPredicate is a function that indicates whether the given node's conditions meet some set of criteria defined by the function.

type StringSet

type StringSet map[string]bool

StringSet is a non-thread safe set of unique strings

func NewStringSet

func NewStringSet(size int) StringSet

NewStringSet constructs and returns a StringSet

func (StringSet) Add

func (s StringSet) Add(e string)

Add adds the string e to the StringSet if it is not already there

func (StringSet) AddAll

func (s StringSet) AddAll(es []string)

AddAll adds the strings in es to the StringSet if they are not already there

func (StringSet) Contains

func (s StringSet) Contains(e string) bool

Contains returns true if the string e is in the StringSet, false otherwise

func (StringSet) Remove

func (s StringSet) Remove(e string)

Remove removes the string e from the StringSet if it is there. It is a no-op otherwise

func (StringSet) Size

func (s StringSet) Size() int

Size returns the number of elements in the StringSet

func (StringSet) ToSlice

func (s StringSet) ToSlice() []string

ToSlice returns all the elements of StringSet as a slice of strings

Jump to

Keyboard shortcuts

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