controllerutils

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNodePoolLabel = "kaiwo/nodepool"

Functions

func CalculateNumberOfReplicas

func CalculateNumberOfReplicas(ctx context.Context, k8sClient client.Client, gpuVendor string, totalUserRequestedGpus int, userReplicas int, userGpusPerReplica int, useAvailability bool) (int, int, int, error)

CalculateNumberOfReplicas determines the number of replicas and GPUs per replica based on node labels and optionally available GPU capacity.

func CompareClusterQueues

func CompareClusterQueues(a, b kueuev1beta1.ClusterQueue) bool

func ComparePriorityClasses

func ComparePriorityClasses(a, b kueuev1beta1.WorkloadPriorityClass) bool

func CompareResourceFlavors

func CompareResourceFlavors(a, b kueuev1beta1.ResourceFlavor) bool

func ConvertKaiwoToKueueClusterQueue

func ConvertKaiwoToKueueClusterQueue(kaiwoQueue kaiwo.ClusterQueue) kueuev1beta1.ClusterQueue

func ConvertKaiwoToKueueResourceFlavor

func ConvertKaiwoToKueueResourceFlavor(kaiwoFlavor kaiwo.ResourceFlavorSpec) kueuev1beta1.ResourceFlavor

func ConvertKaiwoToKueueResourceFlavors

func ConvertKaiwoToKueueResourceFlavors(kaiwoFlavors []kaiwo.ResourceFlavorSpec) []kueuev1beta1.ResourceFlavor

func CreateClusterQueue

func CreateClusterQueue(nodePoolResources map[string]kueuev1beta1.FlavorQuotas, name string) kaiwo.ClusterQueue

func CreateLocalQueue

func CreateLocalQueue(ctx context.Context, c client.Client, name string, namespace string) error

CreateLocalQueue creates a LocalQueue in the given namespace.

func EnsureConfig added in v0.1.4

func EnsureConfig(ctx context.Context, k8sClient client.Client) error

EnsureConfig ensures that a Kaiwo configuration exists within the cluster. It provides a way to either create one automatically, or to give some time for another system to create one while the controller is starting.

func EnsureNamespaceKueueManaged

func EnsureNamespaceKueueManaged(ctx context.Context, k8sClient client.Client, namespaceName string) error

func FindFlavor

func FindFlavor(flavors []kueuev1beta1.ResourceFlavor, name string) (kueuev1beta1.ResourceFlavor, bool)

func GetContextWithConfig added in v0.1.4

func GetContextWithConfig(ctx context.Context, k8sClient client.Client) (context.Context, error)

GetContextWithConfig fetches the latest config and attaches it to a given context

func LabelNode

func LabelNode(ctx context.Context, c client.Client, nodeName, key, value string) error

func MapGPUDeviceIDToName

func MapGPUDeviceIDToName(gpuID string, vendor string) string

func RemoveDuplicateResourceFlavors

func RemoveDuplicateResourceFlavors(flavors []kaiwo.ResourceFlavorSpec) []kaiwo.ResourceFlavorSpec

func TaintNode

func TaintNode(ctx context.Context, client client.Client, nodeName string, taint corev1.Taint) error

Types

type KaiwoConfigContext added in v0.1.4

type KaiwoConfigContext struct {
	configapi.KaiwoConfigSpec
}

KaiwoConfigContext holds the config that is relevant for a particular context In the future it can be extended with namespace-specific configuration as well

func ConfigFromContext added in v0.1.4

func ConfigFromContext(ctx context.Context) KaiwoConfigContext

ConfigFromContext extracts the cfg (or panics if missing).

type NodeResourceInfo

type NodeResourceInfo struct {
	Name          string
	CPU           int
	Memory        int
	Labels        map[string]string
	Unschedulable bool
}

func GetNodeResources

func GetNodeResources(ctx context.Context, c client.Client) []NodeResourceInfo

Jump to

Keyboard shortcuts

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