workloadutils

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: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KaiwoDownloadTypeLabelValue = "downloader"
)

Variables

View Source
var (
	DefaultMemory = resource.MustParse("16Gi")
	DefaultCPU    = resource.MustParse("2")
)

Functions

func AddEntrypoint

func AddEntrypoint(entrypoint string, podTemplateSpec *corev1.PodTemplateSpec) error

AddEntrypoint updates the entrypoint command in the PodTemplateSpec.

func CheckPodStatus

func CheckPodStatus(ctx context.Context, k8sClient client.Client, name string, namespace string, startTime *metav1.Time) (lastStartTime *metav1.Time, status kaiwo.Status, err error)

func ClusterHasGpuDemand added in v0.1.4

func ClusterHasGpuDemand(ctx context.Context, k8sClient client.Client, clusterQueue string, gpuVendor string, config controllerutils.KaiwoConfigContext) (bool, error)

func DeleteUnderlyingResource added in v0.1.4

func DeleteUnderlyingResource(ctx context.Context, uid types.UID, name string, namespace string, k8sClient client.Client) error

func FillPodResources

func FillPodResources(podSpec *corev1.PodSpec, resources *corev1.ResourceRequirements, override bool)

FillPodResources fills pod resources with a given template if they are not already set

func GetEarliestPodStartTime

func GetEarliestPodStartTime(ctx context.Context, k8sClient client.Client, name string, namespace string) *metav1.Time

func GetPodTemplate

func GetPodTemplate(config controllerutils.KaiwoConfigContext, dshmSize resource.Quantity, dangerous bool, resources corev1.ResourceRequirements, workloadContainerName string) corev1.PodTemplateSpec

func GetRayClusterTemplate

func GetRayClusterTemplate(config controllerutils.KaiwoConfigContext, dangerous bool, resourceRequirements v1.ResourceRequirements) *rayv1.RayClusterSpec

func ShouldPreempt added in v0.1.4

func ShouldPreempt(ctx context.Context, obj common.KaiwoWorkload, k8sClient client.Client) bool

func SyncGpuMetaFromPodSpec added in v0.1.4

func SyncGpuMetaFromPodSpec(podSpec corev1.PodSpec, meta *kaiwo.CommonMetaSpec)

func ToPascalCase added in v0.1.4

func ToPascalCase(s string) string

ToPascalCase transforms a string like "hello there" into "HelloThere".

func UpdatePodSpec

func UpdatePodSpec(config controllerutils.KaiwoConfigContext, kaiwoCommonMetaSpec kaiwo.CommonMetaSpec, labelContext common.KaiwoLabelContext, template *corev1.PodTemplateSpec, name string, replicas int, gpusPerReplica int, override bool, rayhead bool) error

func ValidateKaiwoResourceBeforeCreateOrUpdate

func ValidateKaiwoResourceBeforeCreateOrUpdate(ctx context.Context, actual client.Object, kaiwoObjectMeta metav1.ObjectMeta) (*ctrl.Result, error)

Types

type DownloadJobConfigMapReconciler

type DownloadJobConfigMapReconciler struct {
	common.ResourceReconcilerBase[*corev1.ConfigMap]
	StorageSpec *v1alpha1.StorageSpec
}

func NewDownloadJobConfigMapReconciler

func NewDownloadJobConfigMapReconciler(objectKey client.ObjectKey, storageSpec *v1alpha1.StorageSpec) *DownloadJobConfigMapReconciler

func (*DownloadJobConfigMapReconciler) Build

func (*DownloadJobConfigMapReconciler) GetEmptyObject

func (r *DownloadJobConfigMapReconciler) GetEmptyObject() *corev1.ConfigMap

type DownloadJobReconciler

type DownloadJobReconciler struct {
	common.ResourceReconcilerBase[*batchv1.Job]
	StorageSpec *v1alpha1.StorageSpec
	PvcBaseName string
	UserEnvVars []corev1.EnvVar
}

func NewDownloadJobReconciler

func NewDownloadJobReconciler(objectKey client.ObjectKey, storageSpec *v1alpha1.StorageSpec, pvcBaseName string, userEnvVars []corev1.EnvVar) *DownloadJobReconciler

func (*DownloadJobReconciler) Build

func (*DownloadJobReconciler) GetEmptyObject

func (r *DownloadJobReconciler) GetEmptyObject() *batchv1.Job

func (*DownloadJobReconciler) ShouldContinue

func (r *DownloadJobReconciler) ShouldContinue(ctx context.Context, actual *batchv1.Job) *ctrl.Result

Jump to

Keyboard shortcuts

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