Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add configurable pod runtime #60

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docker/Dockerfile.k3d
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ rm -rf /var/lib/apt/lists/* /var/log/*
EOT

COPY --from=k3s /bin /bin
COPY docker/config.toml.tmpl /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl

VOLUME /var/lib/kubelet
VOLUME /var/lib/rancher/k3s
Expand Down
118 changes: 0 additions & 118 deletions docker/config.toml.tmpl

This file was deleted.

1 change: 1 addition & 0 deletions internal/common/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ worker:
minFreeMemory: 1Gi
nvidia:
gpuType: A40
runtime: nvidia
jobSpec:
nodeSelector: {}
poolSizing:
Expand Down
7 changes: 6 additions & 1 deletion internal/scheduler/pool_k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ func (wpc *KubernetesWorkerPoolController) createWorkerJob(workerId string, cpu
workerMemory = wpc.config.Worker.DefaultWorkerMemoryRequest
}

if gpuType != "" {
workerPool, _ := wpc.GetWorkerPoolConfig()
if gpuType != "" && workerPool.Runtime == "nvidia" {
resourceRequests[corev1.ResourceName("nvidia.com/gpu")] = *resource.NewQuantity(1, resource.DecimalSI)
}

Expand Down Expand Up @@ -243,6 +244,10 @@ func (wpc *KubernetesWorkerPoolController) createWorkerJob(workerId string, cpu
},
}

if workerPool.Runtime != "" {
podTemplate.Spec.RuntimeClassName = ptr.To(workerPool.Runtime)
}

ttl := int32(30)
job := &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Expand Down
1 change: 1 addition & 0 deletions internal/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ type WorkerConfig struct {

type WorkerPoolConfig struct {
GPUType string `key:"gpuType"`
Runtime string `key:"runtime"`
JobSpec WorkerPoolJobSpecConfig `key:"jobSpec"`
PoolSizing WorkerPoolJobSpecPoolSizingConfig `key:"poolSizing"`
}
Expand Down