Skip to content

Commit

Permalink
enable hostPID in mps-control-daemon
Browse files Browse the repository at this point in the history
Signed-off-by: Tariq Ibrahim <[email protected]>
  • Loading branch information
tariq1890 committed Nov 18, 2024
1 parent 3fe91a3 commit 88d1f96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions assets/state-mps-control-daemon/0400_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spec:
effect: NoSchedule
priorityClassName: system-node-critical
serviceAccountName: nvidia-device-plugin
hostPID: true
initContainers:
- image: "FILLED BY THE OPERATOR"
name: toolkit-validation
Expand Down
11 changes: 8 additions & 3 deletions controllers/object_controls.go
Original file line number Diff line number Diff line change
Expand Up @@ -2479,9 +2479,14 @@ func handleDevicePluginConfig(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicy
// add configmap volume mount
addSharedMountsForPluginConfig(&obj.Spec.Template.Spec.Containers[i], config.DevicePlugin.Config)
}
// Enable process ns sharing for PID access
shareProcessNamespace := true
obj.Spec.Template.Spec.ShareProcessNamespace = &shareProcessNamespace

// if hostPID is already set, we skip setting the shareProcessNamespace field
// for context, go to https://github.com/kubernetes-client/go/blob/master/kubernetes/docs/V1PodSpec.md
if !obj.Spec.Template.Spec.HostPID {
// Enable process ns sharing for PID access
shareProcessNamespace := true
obj.Spec.Template.Spec.ShareProcessNamespace = &shareProcessNamespace
}
// add configmap volume
obj.Spec.Template.Spec.Volumes = append(obj.Spec.Template.Spec.Volumes, createConfigMapVolume(config.DevicePlugin.Config.Name, nil))

Expand Down

0 comments on commit 88d1f96

Please sign in to comment.