k8s

package
v0.1.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateNumberOfReplicas

func CalculateNumberOfReplicas(requestedGpus int, gpusPerNode int, envVars []corev1.EnvVar) (int, int)

CalculateNumberOfReplicas attempts to balance the number of replicas by maximizing the number of GPUs used per node

func GetClient

func GetClient() (client.Client, error)

func GetClientset

func GetClientset() (*kubernetes.Clientset, error)

func GetClusterQueue

func GetClusterQueue(ctx context.Context, k8sClient client.Client, clusterQueueName string) (*kueuev1beta1.ClusterQueue, error)

func GetDefaultResourceFlavorGpuCount

func GetDefaultResourceFlavorGpuCount(ctx context.Context, k8sClient client.Client, labelKey string) (int, error)

func GetDynamicClient

func GetDynamicClient() (dynamic.Interface, error)

GetDynamicClient provides a singleton for the dynamic client

func GetKubeConfig

func GetKubeConfig() (string, error)

GetKubeConfig loads the kubeconfig file path

func GetResourceFlavorGpuCount

func GetResourceFlavorGpuCount(resourceFlavor kueuev1beta1.ResourceFlavor, labelKey string) (int, error)

func GetScheme

func GetScheme() (runtime.Scheme, error)

func InitializeDynamicClient

func InitializeDynamicClient() (dynamic.Interface, error)

InitializeDynamicClient initializes the dynamic Kubernetes client

func ListResourceFlavorsWithNodeLabel

func ListResourceFlavorsWithNodeLabel(ctx context.Context, k8sClient client.Client, labelKey string) ([]kueuev1beta1.ResourceFlavor, error)

func MinimalizeAndConvertToYAML

func MinimalizeAndConvertToYAML(s *runtime.Scheme, obj runtime.Object) (string, error)

MinimalizeAndConvertToYAML converts a runtime.Object or client.Object to its YAML representation while removing read-only fields like `metadata.creationTimestamp`, `status`, and others.

func PrepareLocalClusterQueue

func PrepareLocalClusterQueue(ctx context.Context, queueName string, namespace string, k8sClient client.Client) (*kueuev1beta1.LocalQueue, error)

Types

type EnvVarInput

type EnvVarInput struct {
	Name       string `yaml:"name,omitempty"`
	Value      string `yaml:"value,omitempty"`
	FromSecret *struct {
		Name   string `yaml:"name"`
		Secret string `yaml:"secret"`
		Key    string `yaml:"key"`
	} `yaml:"fromSecret,omitempty"`
	MountSecret *struct {
		Name   string `yaml:"name"`
		Secret string `yaml:"secret"`
		Key    string `yaml:"key"`
		Path   string `yaml:"path"`
	} `yaml:"mountSecret,omitempty"`
}

type KubernetesClients

type KubernetesClients struct {
	Client     client.Client
	Clientset  *kubernetes.Clientset
	Kubeconfig *rest.Config
}

func GetKubernetesClients

func GetKubernetesClients() (*KubernetesClients, error)

Jump to

Keyboard shortcuts

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