Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MAKE_TARGETS := build check fmt test check-vendor update-pcidb clean $(CHECK_TAR
TARGETS := $(MAKE_TARGETS)

DOCKER_TARGETS := $(patsubst %,docker-%, $(TARGETS))
.PHONY: $(TARGETS) $(DOCKER_TARGETS)
.PHONY: $(TARGETS) $(DOCKER_TARGETS) docker-test

GOOS ?= linux

Expand Down Expand Up @@ -91,3 +91,12 @@ update-pcidb:

clean:
rm -rf nvidia-kubevirt-gpu-device-plugin && rm -rf coverage.out

docker-test:
$(DOCKER) build --target builder \
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
--build-arg DRIVER_VERSION="$(DRIVER_VERSION)" \
-t kubevirt-gpu-test \
-f deployments/container/Dockerfile.distroless .
$(DOCKER) run --rm kubevirt-gpu-test \
bash -c "CGO_ENABLED=1 CGO_CPPFLAGS='-I/usr/include' CGO_LDFLAGS='-L/usr/lib -lnvfm' go test -tags=nvfm -coverprofile=coverage.out.with-mocks $(MODULE)/..."
17 changes: 16 additions & 1 deletion deployments/container/Dockerfile.distroless
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,19 @@
FROM nvcr.io/nvidia/cuda:13.1.1-base-ubi9 AS builder

ARG GOLANG_VERSION
ARG DRIVER_VERSION

RUN yum install -y wget tar gzip make gcc glibc-devel

# Install Fabric Manager SDK for NVLink partition support
# Setup NVIDIA network repository and install FM devel package
RUN dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo \
&& dnf clean expire-cache \
&& DRIVER_STREAM=$(echo "${DRIVER_VERSION}" | cut -d. -f1) \
&& dnf module enable -y nvidia-driver:${DRIVER_STREAM}-open/default \
&& dnf install -y nvidia-fabric-manager-devel-${DRIVER_VERSION} \
&& dnf clean all

RUN set -eux; \
\
arch="$(uname -m)"; \
Expand Down Expand Up @@ -58,7 +68,9 @@ RUN go mod download
COPY . .

RUN CGO_ENABLED=1 \
go build -trimpath -o nvidia-kubevirt-gpu-device-plugin ./cmd
CGO_CPPFLAGS="-I/usr/include" \
CGO_LDFLAGS="-L/usr/lib -lnvfm" \
go build -trimpath -tags=nvfm -o nvidia-kubevirt-gpu-device-plugin ./cmd

FROM nvcr.io/nvidia/distroless/go:v4.0.2

Expand All @@ -74,6 +86,9 @@ LABEL description="See summary"

COPY --from=builder /workspace/nvidia-kubevirt-gpu-device-plugin /usr/bin/
COPY --from=builder /workspace/utils/pci.ids /usr/pci.ids
COPY --from=builder /usr/lib64/libnvfm* /usr/lib64/

ENV LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH

USER 0:0

Expand Down
3 changes: 2 additions & 1 deletion deployments/container/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ endif

GOPROXY ?= https://proxy.golang.org,direct

IMAGE_VERSION := $(VERSION)
IMAGE_VERSION := $(VERSION)-$(DRIVER_VERSION)

IMAGE = $(IMAGE_NAME):$(IMAGE_VERSION)

Expand Down Expand Up @@ -63,6 +63,7 @@ $(BUILD_TARGETS): build-%:
--build-arg VERSION="$(VERSION)" \
--build-arg GIT_COMMIT="$(GIT_COMMIT)" \
--build-arg GOPROXY="$(GOPROXY)" \
--build-arg DRIVER_VERSION="$(DRIVER_VERSION)" \
--file $(DOCKERFILE) \
$(CURDIR)
ifeq ($(PUSH_ON_BUILD),true)
Expand Down
7 changes: 7 additions & 0 deletions manifests/nvidia-kubevirt-gpu-device-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ spec:
containers:
- name: nvidia-kubevirt-gpu-dp-ctr
image: nvcr.io/nvidia/kubevirt-gpu-device-plugin:v1.5.0
env:
# Fabric Manager Integration (Tech Preview)
# Set to "true" to enable fabric manager partition coordination
# Requires fabric manager daemon running on the node
# Defaults to "false" - device plugin works normally without it
- name: ENABLE_FABRIC_MANAGER
value: "false"
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down
Loading