-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
packages: add NVIDIA k8s device plugin
The NVIDIA k8s device plugin exposes to the kubelet the NVIDIA GPUs in the host. By providing the k8s device plugin in the base image, the startup time for a GPU workload decreases, since the kubelet doesn't have to fetch yet another system container. Signed-off-by: Arnaldo Garcia Rincon <[email protected]>
- Loading branch information
1 parent
5b9bc1d
commit 6d39439
Showing
7 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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,19 @@ | ||
[package] | ||
name = "nvidia-k8s-device-plugin" | ||
version = "0.1.0" | ||
edition = "2018" | ||
publish = false | ||
build = "build.rs" | ||
|
||
[lib] | ||
path = "pkg.rs" | ||
|
||
[package.metadata.build-package] | ||
releases-url = "https://github.com/NVIDIA/k8s-device-plugin/releases" | ||
|
||
[[package.metadata.build-package.external-files]] | ||
url = "https://github.com/NVIDIA/k8s-device-plugin/archive/v0.10.0/v0.10.0.tar.gz" | ||
sha512 = "d83107ef511a1fa8b43596726e084feea1bbf9b0e22754444e76cbf0aefd5476421d00bc02173c606509f0dbf7b4e86f9453d59fca976b7f8f15c7667932bebe" | ||
|
||
[build-dependencies] | ||
glibc = { path = "../glibc" } |
This file contains 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,9 @@ | ||
use std::process::{exit, Command}; | ||
|
||
fn main() -> Result<(), std::io::Error> { | ||
let ret = Command::new("buildsys").arg("build-package").status()?; | ||
if !ret.success() { | ||
exit(1); | ||
} | ||
Ok(()) | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/nvidia-k8s-device-plugin/nvidia-k8s-device-plugin.service
This file contains 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,17 @@ | ||
[Unit] | ||
Description=Start NVIDIA kubernetes device plugin | ||
RefuseManualStart=true | ||
RefuseManualStop=true | ||
After=kubelet.service | ||
BindsTo=kubelet.service | ||
|
||
[Service] | ||
ExecStart=/usr/bin/nvidia-device-plugin | ||
Type=simple | ||
TimeoutSec=0 | ||
RestartSec=2 | ||
Restart=always | ||
StandardError=journal+console | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
43 changes: 43 additions & 0 deletions
43
packages/nvidia-k8s-device-plugin/nvidia-k8s-device-plugin.spec
This file contains 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,43 @@ | ||
%global goproject github.com/NVIDIA | ||
%global gorepo k8s-device-plugin | ||
%global goimport %{goproject}/%{gorepo} | ||
|
||
%global gover 0.10.0 | ||
%global rpmver %{gover} | ||
|
||
Name: %{_cross_os}nvidia-k8s-device-plugin | ||
Version: %{rpmver} | ||
Release: 1%{?dist} | ||
Summary: Kubernetes device plugin for NVIDIA GPUs | ||
License: Apache-2.0 | ||
URL: https://github.com/NVIDIA/k8s-device-plugin | ||
Source0: https://%{goimport}/archive/v%{gover}/v%{gover}.tar.gz | ||
Source1: nvidia-k8s-device-plugin.service | ||
|
||
BuildRequires: %{_cross_os}glibc-devel | ||
|
||
%description | ||
%{summary}. | ||
|
||
%prep | ||
%autosetup -n %{gorepo}-%{gover} -p1 | ||
%cross_go_setup %{gorepo}-%{gover} %{goproject} %{goimport} | ||
|
||
%build | ||
%cross_go_configure %{goimport} | ||
# We don't set `-Wl,-z,now`, because the binary uses lazy loading | ||
# to load the NVIDIA libraries in the host | ||
export CGO_LDFLAGS="-Wl,-z,relro" | ||
go build -ldflags="${GOLDFLAGS}" -o nvidia-device-plugin ./cmd/nvidia-device-plugin/ | ||
|
||
%install | ||
install -d %{buildroot}%{_cross_bindir} | ||
install -d %{buildroot}%{_cross_unitdir} | ||
install -p -m 0755 nvidia-device-plugin %{buildroot}%{_cross_bindir} | ||
install -p -m 0644 %{S:1} %{buildroot}%{_cross_unitdir} | ||
|
||
%files | ||
%license LICENSE | ||
%{_cross_attribution_file} | ||
%{_cross_unitdir}/nvidia-k8s-device-plugin.service | ||
%{_cross_bindir}/nvidia-device-plugin |
This file contains 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 @@ | ||
// not used |