util

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListLength = 100
)

Variables

View Source
var (
	ErrNoMapping  = errors.New("no mapping found")
	ErrLQNotFound = errors.New("localqueue not found")
	ErrCQNotFound = errors.New("clusterqueue not found")
	ErrCQInvalid  = errors.New("clusterqueue invalid")
	ErrPCNotFound = errors.New("priorityclass not found")
)

Functions

func PushPods

func PushPods(ctx context.Context, c client.Client, namespaces []string, ch chan<- corev1.Pod) error

Types

type ImportCache

type ImportCache struct {
	Namespaces      []string
	MappingRules    MappingRules
	LocalQueues     map[string]map[string]*kueue.LocalQueue
	ClusterQueues   map[string]*kueue.ClusterQueue
	ResourceFlavors map[kueue.ResourceFlavorReference]*kueue.ResourceFlavor
	PriorityClasses map[string]*schedulingv1.PriorityClass
	AddLabels       map[string]string
}

func LoadImportCache

func LoadImportCache(ctx context.Context, c client.Client, namespaces []string, mappingRules MappingRules, addLabels map[string]string) (*ImportCache, error)

func (*ImportCache) ClusterQueue

func (mappingCache *ImportCache) ClusterQueue(p *corev1.Pod) (*kueue.ClusterQueue, bool, error)

func (*ImportCache) LocalQueue

func (mappingCache *ImportCache) LocalQueue(p *corev1.Pod) (*kueue.LocalQueue, bool, error)

type MappingMatch

type MappingMatch struct {
	PriorityClassName string            `json:"priorityClassName"`
	Labels            map[string]string `json:"labels"`
}

func (*MappingMatch) Match

func (mm *MappingMatch) Match(priorityClassName string, labels map[string]string) bool

type MappingRule

type MappingRule struct {
	Match        MappingMatch `json:"match"`
	ToLocalQueue string       `json:"toLocalQueue"`
	Skip         bool         `json:"skip"`
}

type MappingRules

type MappingRules []MappingRule

func MappingRulesForLabel

func MappingRulesForLabel(label string, m map[string]string) MappingRules

func MappingRulesFromFile

func MappingRulesFromFile(mappingFile string) (MappingRules, error)

func (MappingRules) QueueFor

func (mr MappingRules) QueueFor(priorityClassName string, labels map[string]string) (string, bool, bool)

type ProcessSummary

type ProcessSummary struct {
	TotalPods     int
	SkippedPods   int
	FailedPods    int
	ErrorsForPods map[string][]string
	Errors        []error
}

func ConcurrentProcessPod

func ConcurrentProcessPod(ch <-chan corev1.Pod, jobs uint, f func(p *corev1.Pod) (bool, error)) ProcessSummary

type Result

type Result struct {
	Pod  string
	Err  error
	Skip bool
}

Jump to

Keyboard shortcuts

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