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

feat: added nvidia runtime if there's gpu detected #2258

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions api/v1beta2/sparkapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ type SparkPodSpec struct {
// ShareProcessNamespace settings for the pod, following the Kubernetes specifications.
// +optional
ShareProcessNamespace *bool `json:"shareProcessNamespace,omitempty"`

RuntimeClassName *string `json:"runtimeClassName,omitempty" protobuf:"bytes,29,opt,name=runtimeClassName"`
}

// DriverSpec is specification of the driver.
Expand Down
11 changes: 11 additions & 0 deletions internal/webhook/sparkpod_defaulter.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func mutateSparkPod(pod *corev1.Pod, app *v1beta2.SparkApplication) error {
addTerminationGracePeriodSeconds,
addPodLifeCycleConfig,
addShareProcessNamespace,
addRuntimeClassName,
}

for _, option := range options {
Expand Down Expand Up @@ -677,6 +678,16 @@ func addPodLifeCycleConfig(pod *corev1.Pod, app *v1beta2.SparkApplication) error
return nil
}

func addRuntimeClassName(pod *corev1.Pod, app *v1beta2.SparkApplication) error {
nvidiaRuntimeClass := "nvidia"

if app.Spec.Executor.GPU != nil {
app.Spec.Driver.RuntimeClassName = &nvidiaRuntimeClass
}

return nil
}

func addHostAliases(pod *corev1.Pod, app *v1beta2.SparkApplication) error {
var hostAliases []corev1.HostAlias
if util.IsDriverPod(pod) {
Expand Down
Loading