Skip to content

Commit e0d8fee

Browse files
committed
packages: add rocm-k8s-device-plugin
Signed-off-by: Gaurav Sharma <[email protected]>
1 parent f89c682 commit e0d8fee

File tree

6 files changed

+124
-0
lines changed

6 files changed

+124
-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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
18+
[build-dependencies]
19+
glibc = { path = "../glibc" }
20+
libdrm = { path = "../libdrm" }
21+
hwloc = { path = "../hwloc" }
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[Unit]
2+
Description=Start ROCm kubernetes device plugin
3+
After=kubelet.service [email protected]
4+
Wants=kubelet.service [email protected]
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+
TimeoutSec=0
13+
RestartSec=2
14+
Restart=always
15+
16+
[Install]
17+
WantedBy=multi-user.target
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
52+
go build -ldflags="${GOLDFLAGS}" -o rocm-device-plugin ./cmd/k8s-device-plugin/
53+
gofips build -ldflags="${GOLDFLAGS}" -o fips/rocm-device-plugin ./cmd/k8s-device-plugin/
54+
55+
%install
56+
install -d %{buildroot}%{_cross_bindir}
57+
install -p -m 0755 rocm-device-plugin %{buildroot}%{_cross_bindir}
58+
59+
install -d %{buildroot}%{_cross_fips_bindir}
60+
install -p -m 0755 fips/rocm-device-plugin %{buildroot}%{_cross_fips_bindir}
61+
62+
install -d %{buildroot}%{_cross_unitdir}
63+
install -p -m 0644 %{S:1} %{buildroot}%{_cross_unitdir}
64+
65+
%files
66+
%license LICENSE
67+
%{_cross_attribution_file}
68+
%{_cross_unitdir}/rocm-k8s-device-plugin.service
69+
70+
%files bin
71+
%{_cross_bindir}/rocm-device-plugin
72+
73+
%files fips-bin
74+
%{_cross_fips_bindir}/rocm-device-plugin

0 commit comments

Comments
 (0)