generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 53
Add MPS control daemon support to k8s device plugin #789
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
packages/nvidia-k8s-device-plugin/0001-Update-MPS-roots-for-immutable-host-OS.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| From efde4273b89c623e036109bfb949926e7fc89b50 Mon Sep 17 00:00:00 2001 | ||
| From: Matthew Yeazel <[email protected]> | ||
| Date: Wed, 31 Dec 2025 19:46:25 +0000 | ||
| Subject: [PATCH] Update MPS roots for immutable host OS | ||
|
|
||
| The code assumes its in the container for the device plugin. The paths | ||
| it creates for tracking state and shared memory won't work on | ||
| Bottlerocket since the root filesystem is immutable. Move these paths to | ||
| /run to allow the files to be created. | ||
|
|
||
| Signed-off-by: Matthew Yeazel <[email protected]> | ||
| --- | ||
| cmd/mps-control-daemon/main.go | 4 ++-- | ||
| cmd/mps-control-daemon/mount/mount-shm.go | 2 +- | ||
| cmd/mps-control-daemon/mps/root.go | 2 +- | ||
| 3 files changed, 4 insertions(+), 4 deletions(-) | ||
|
|
||
| diff --git a/cmd/mps-control-daemon/main.go b/cmd/mps-control-daemon/main.go | ||
| index bb5502f..ec296a4 100644 | ||
| --- a/cmd/mps-control-daemon/main.go | ||
| +++ b/cmd/mps-control-daemon/main.go | ||
| @@ -214,7 +214,7 @@ func startDaemons(c *cli.Context, cfg *Config) ([]*mps.Daemon, bool, error) { | ||
| return mpsDaemons, true, nil | ||
| } | ||
| } | ||
| - readyFile, err := os.Create("/mps/.ready") | ||
| + readyFile, err := os.Create("/run/mps/.ready") | ||
| if err != nil { | ||
| return mpsDaemons, true, fmt.Errorf("failed to create .ready file") | ||
| } | ||
| @@ -224,7 +224,7 @@ func startDaemons(c *cli.Context, cfg *Config) ([]*mps.Daemon, bool, error) { | ||
| } | ||
|
|
||
| func stopDaemons(mpsDaemons ...*mps.Daemon) error { | ||
| - if err := os.Remove("/mps/.ready"); err != nil { | ||
| + if err := os.Remove("/run/mps/.ready"); err != nil { | ||
| klog.Warningf("Failed to remove .ready file: %v", err) | ||
| } | ||
| klog.Info("Stopping MPS daemons.") | ||
| diff --git a/cmd/mps-control-daemon/mount/mount-shm.go b/cmd/mps-control-daemon/mount/mount-shm.go | ||
| index 83825e8..507a1e4 100644 | ||
| --- a/cmd/mps-control-daemon/mount/mount-shm.go | ||
| +++ b/cmd/mps-control-daemon/mount/mount-shm.go | ||
| @@ -49,7 +49,7 @@ func mountShm(c *cli.Context) error { | ||
| mounter := mount.New(mountExecutable) | ||
|
|
||
| // TODO: /mps should be configurable. | ||
| - shmDir := "/mps/shm" | ||
| + shmDir := "/run/mps/shm" | ||
| err = mount.CleanupMountPoint(shmDir, mounter, true) | ||
| if err != nil { | ||
| return fmt.Errorf("error unmounting %v: %w", shmDir, err) | ||
| diff --git a/cmd/mps-control-daemon/mps/root.go b/cmd/mps-control-daemon/mps/root.go | ||
| index 90655d1..805e58d 100644 | ||
| --- a/cmd/mps-control-daemon/mps/root.go | ||
| +++ b/cmd/mps-control-daemon/mps/root.go | ||
| @@ -23,7 +23,7 @@ import ( | ||
| ) | ||
|
|
||
| const ( | ||
| - ContainerRoot = Root("/mps") | ||
| + ContainerRoot = Root("/run/mps") | ||
| ) | ||
|
|
||
| // Root represents an MPS root. | ||
| -- | ||
| 2.52.0 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/nvidia-k8s-device-plugin/nvidia-mps-control-daemon-exec-start-conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| [required-extensions] | ||
| kubelet-device-plugins = "v1" | ||
| +++ | ||
| [Service] | ||
| ExecStart= | ||
| {{#if (eq settings.kubelet-device-plugins.nvidia.device-sharing-strategy "mps")}} | ||
| {{#if (eq settings.kubelet-device-plugins.nvidia.device-partitioning-strategy "mig")}} | ||
| # MPS and MIG are not supported at the same time | ||
| Type=oneshot | ||
| ExecStart=/bin/echo "MPS and MIG are not supported at the same time" | ||
| {{else}} | ||
| Type=simple | ||
| ExecStart=/usr/bin/mps-control-daemon --config-file /etc/nvidia-k8s-device-plugin/settings.yaml | ||
yeazelm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| RemainAfterExit=no | ||
| {{/if}} | ||
| {{else}} | ||
| Type=oneshot | ||
| ExecStart=/usr/bin/true | ||
| RemainAfterExit=yes | ||
| {{/if}} | ||
12 changes: 12 additions & 0 deletions
12
packages/nvidia-k8s-device-plugin/nvidia-mps-control-daemon.service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [Unit] | ||
| Description=NVIDIA MPS Control Daemon | ||
| Before=nvidia-k8s-device-plugin.service | ||
|
|
||
| [Service] | ||
| ExecStart=/usr/bin/true | ||
| Restart=on-failure | ||
| RestartSec=2 | ||
| RemainAfterExit=true | ||
|
|
||
| [Install] | ||
| RequiredBy=nvidia-k8s-device-plugin.service |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.