Skip to content

Commit a20940d

Browse files
committed
Add rocm-k8s-device-plugin package
Signed-off-by: Gaurav Sharma <[email protected]>
1 parent a2bdd04 commit a20940d

File tree

7 files changed

+145
-0
lines changed

7 files changed

+145
-0
lines changed

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ members = [
118118
"packages/rdma-core",
119119
"packages/readline",
120120
"packages/release",
121+
"packages/rocm-k8s-device-plugin",
121122
"packages/runc",
122123
"packages/selinux-policy",
123124
"packages/soci-snapshotter",

kits/bottlerocket-core-kit/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ procps = { path = "../../packages/procps" }
129129
rdma-core = { path = "../../packages/rdma-core" }
130130
readline = { path = "../../packages/readline" }
131131
release = { path = "../../packages/release" }
132+
rocm-k8s-device-plugin = { path = "../../packages/rocm-k8s-device-plugin" }
132133
rottweiler = { path = "../../packages/rottweiler" }
133134
runc = { path = "../../packages/runc" }
134135
selinux-policy = { path = "../../packages/selinux-policy" }
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[Unit]
2+
Description=Start AMD kubernetes device plugin
3+
After=kubelet.service
4+
Wants=kubelet.service
5+
6+
[Service]
7+
ExecStartPre=/usr/bin/sleep 0.1
8+
ExecStartPre=/usr/bin/test -S /var/lib/kubelet/device-plugins/kubelet.sock
9+
ExecStart=/usr/bin/amd-device-plugin -logtostderr=true -stderrthreshold=INFO -v=5
10+
Type=simple
11+
TimeoutSec=0
12+
RestartSec=2
13+
Restart=always
14+
StandardError=journal+console
15+
16+
[Install]
17+
WantedBy=multi-user.target
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "rocm-k8s-device-plugin"
3+
version = "0.1.0"
4+
edition = "2021"
5+
publish = false
6+
build = "../build.rs"
7+
8+
[lib]
9+
path = "../packages.rs"
10+
11+
[package.metadata.build-package]
12+
releases-url = "https://github.com/ROCm/k8s-device-plugin/releases"
13+
14+
[[package.metadata.build-package.external-files]]
15+
url = "https://github.com/ROCm/k8s-device-plugin/archive/v1.31.0.8.tar.gz"
16+
sha512 = "23a127b46ad15cabbdd9abe18a8b75140340dcb10f41c9efdcfd30b38db7142edabaf6a97ed2c621f0414c78c0cb87fdc81a30b5e3fb016d16cbd11210143326"
17+
force-upstream = true
18+
19+
[build-dependencies]
20+
glibc = { path = "../glibc" }
21+
libdrm = { path = "../libdrm" }
22+
hwloc = { path = "../hwloc" }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[Unit]
2+
Description=Start ROCm kubernetes device plugin
3+
After=kubelet.service
4+
Wants=kubelet.service
5+
6+
[Service]
7+
# Ensure that the kubelet device plugin socket exists before we start
8+
# A brief sleep is needed to avoid the `test` failing its first check
9+
ExecStartPre=/usr/bin/sleep 0.1
10+
ExecStartPre=/usr/bin/test -S /var/lib/kubelet/device-plugins/kubelet.sock
11+
ExecStart=/usr/bin/rocm-device-plugin -logtostderr=true -stderrthreshold=INFO -v=5
12+
Type=simple
13+
TimeoutSec=0
14+
RestartSec=2
15+
Restart=always
16+
StandardError=journal+console
17+
18+
[Install]
19+
WantedBy=multi-user.target
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
%global goproject github.com/ROCm
2+
%global gorepo k8s-device-plugin
3+
%global goimport %{goproject}/%{gorepo}
4+
5+
%global gover 1.31.0.8
6+
%global rpmver %{gover}
7+
8+
Name: %{_cross_os}rocm-k8s-device-plugin
9+
Version: %{rpmver}
10+
Release: 1%{?dist}
11+
Summary: Kubernetes device plugin for AMD GPUs
12+
License: Apache-2.0
13+
URL: https://github.com/ROCm/k8s-device-plugin
14+
Source0: https://github.com/ROCm/k8s-device-plugin/archive/v%{gover}.tar.gz
15+
Source1: rocm-k8s-device-plugin.service
16+
17+
BuildRequires: %{_cross_os}glibc-devel
18+
BuildRequires: %{_cross_os}libdrm-devel
19+
BuildRequires: %{_cross_os}hwloc-devel
20+
Requires: %{name}(binaries)
21+
Requires: %{_cross_os}libdrm
22+
Requires: %{_cross_os}hwloc
23+
24+
%description
25+
%{summary}.
26+
27+
%package bin
28+
Summary: Kubernetes device plugin for AMD GPUs binaries
29+
Provides: %{name}(binaries)
30+
Requires: (%{_cross_os}image-feature(no-fips) and %{name})
31+
Conflicts: (%{_cross_os}image-feature(fips) or %{name}-fips-bin)
32+
33+
%description bin
34+
%{summary}.
35+
36+
%package fips-bin
37+
Summary: Kubernetes device plugin for AMD GPUs binaries, FIPS edition
38+
Provides: %{name}(binaries)
39+
Requires: (%{_cross_os}image-feature(fips) and %{name})
40+
Conflicts: (%{_cross_os}image-feature(no-fips) or %{name}-bin)
41+
42+
%description fips-bin
43+
%{summary}.
44+
45+
%prep
46+
%autosetup -n %{gorepo}-%{gover} -p1
47+
%cross_go_setup %{gorepo}-%{gover} %{goproject} %{goimport}
48+
49+
%build
50+
%cross_go_configure %{goimport}
51+
%set_cross_go_flags
52+
53+
go build -ldflags="${GOLDFLAGS}" -o amd-device-plugin ./cmd/k8s-device-plugin/
54+
gofips build -ldflags="${GOLDFLAGS}" -o fips/amd-device-plugin ./cmd/k8s-device-plugin/
55+
56+
%install
57+
install -d %{buildroot}%{_cross_bindir}
58+
install -p -m 0755 amd-device-plugin %{buildroot}%{_cross_bindir}
59+
60+
install -d %{buildroot}%{_cross_fips_bindir}
61+
install -p -m 0755 fips/amd-device-plugin %{buildroot}%{_cross_fips_bindir}
62+
63+
install -d %{buildroot}%{_cross_unitdir}
64+
install -p -m 0644 %{S:1} %{buildroot}%{_cross_unitdir}
65+
66+
%files
67+
%license LICENSE
68+
%{_cross_attribution_file}
69+
%{_cross_unitdir}/rocm-k8s-device-plugin.service
70+
71+
%files bin
72+
%{_cross_bindir}/amd-device-plugin
73+
74+
%files fips-bin
75+
%{_cross_fips_bindir}/amd-device-plugin

0 commit comments

Comments
 (0)