Skip to content

Commit

Permalink
use nvidia gpu only for gpu worker pods
Browse files Browse the repository at this point in the history
  • Loading branch information
nickpetrovic committed Jan 22, 2024
1 parent d3440f2 commit 014dddd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 119 deletions.
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.

6 changes: 6 additions & 0 deletions internal/scheduler/pool_k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ func (wpc *KubernetesWorkerPoolController) createWorkerJob(workerId string, cpu
workerMemory = wpc.config.Worker.DefaultWorkerMemoryRequest
}

runtimeClassName := ""
if gpuType != "" {
runtimeClassName = "nvidia"
resourceRequests[corev1.ResourceName("nvidia.com/gpu")] = *resource.NewQuantity(1, resource.DecimalSI)
}

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

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

ttl := int32(30)
job := &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit 014dddd

Please sign in to comment.