Skip to content

Commit f1315c8

Browse files
authored
Merge pull request #133 from NVIDIA/cpicks-0.9.1
cherrypicked commits for v0.9.1 of k8s-driver-manager
2 parents a837602 + 75a8da1 commit f1315c8

File tree

6 files changed

+66
-44
lines changed

6 files changed

+66
-44
lines changed

.github/workflows/image.yaml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,21 @@ on:
2424

2525
jobs:
2626
build-image:
27-
runs-on: linux-amd64-cpu4
27+
strategy:
28+
matrix:
29+
arch:
30+
- amd64
31+
- arm64
32+
dist: [distroless]
33+
runs-on: linux-${{ matrix.arch }}-cpu4
2834
permissions:
2935
contents: read
3036
id-token: write
3137
packages: write
32-
strategy:
33-
matrix:
34-
dist: [ubi9]
3538
steps:
3639
- uses: actions/checkout@v5
3740
name: Check out code
3841

39-
- name: Set up QEMU
40-
uses: docker/setup-qemu-action@v3
41-
with:
42-
image: tonistiigi/binfmt:master
43-
44-
- name: Set up Docker Buildx
45-
uses: docker/setup-buildx-action@v3
46-
4742
- name: Login to GitHub Container Registry
4843
uses: docker/login-action@v3
4944
with:
@@ -56,10 +51,32 @@ jobs:
5651
- name: Build image
5752
env:
5853
IMAGE_NAME: ghcr.io/nvidia/k8s-driver-manager
59-
VERSION: ${{ inputs.version }}
54+
VERSION: ${{ inputs.version }}-${{ matrix.arch }}
6055
PUSH_ON_BUILD: "true"
61-
BUILD_MULTI_ARCH_IMAGES: "true"
6256
GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
57+
DOCKER_BUILD_PLATFORM_OPTIONS: "--platform=linux/${{ matrix.arch }}"
6358
run: |
6459
echo "${VERSION}"
6560
make -f deployments/container/Makefile build-${{ matrix.dist }}
61+
62+
create-manifest:
63+
needs: build-image
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v5
67+
name: Check out code
68+
- name: Login to GitHub Container Registry
69+
uses: docker/login-action@v3
70+
with:
71+
registry: ghcr.io
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
74+
- name: Build Manifest
75+
env:
76+
MULTIARCH_IMAGE: ghcr.io/nvidia/k8s-driver-manager:${{ inputs.version }}
77+
run: |
78+
docker manifest create \
79+
${MULTIARCH_IMAGE} \
80+
ghcr.io/nvidia/k8s-driver-manager:${{ inputs.version }}-amd64 \
81+
ghcr.io/nvidia/k8s-driver-manager:${{ inputs.version }}-arm64
82+
docker manifest push ${MULTIARCH_IMAGE}

cmd/driver-manager/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -757,11 +757,6 @@ func (dm *DriverManager) waitForMofedDriver() error {
757757

758758
var isMofedLoaded func() bool
759759
if dm.config.useHostMofed {
760-
isMofedLoaded = func() bool {
761-
_, err := os.Stat("/run/mellanox/drivers/.driver-ready")
762-
return err == nil
763-
}
764-
} else {
765760
isMofedLoaded = func() bool {
766761
loadedModules, err := os.ReadFile("/proc/modules")
767762
if err != nil {
@@ -770,6 +765,11 @@ func (dm *DriverManager) waitForMofedDriver() error {
770765
}
771766
return strings.Contains(string(loadedModules), "mlx5_core")
772767
}
768+
} else {
769+
isMofedLoaded = func() bool {
770+
_, err := os.Stat("/run/mellanox/drivers/.driver-ready")
771+
return err == nil
772+
}
773773
}
774774

775775
for !isMofedLoaded() {

deployments/container/Dockerfile.ubi9 renamed to deployments/container/Dockerfile.distroless

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM nvcr.io/nvidia/cuda:13.0.1-base-ubi9 AS build
15+
FROM nvcr.io/nvidia/cuda:13.0.2-base-ubi9 AS build
1616

1717
WORKDIR /work
1818

@@ -52,7 +52,7 @@ RUN go build -ldflags "-extldflags=-Wl,-z,lazy -s -w -X ${VERSION_PKG}.gitCommit
5252

5353
ARG TARGETARCH
5454

55-
FROM nvcr.io/nvidia/distroless/cc:v3.1.13-dev
55+
FROM nvcr.io/nvidia/distroless/cc:v3.2.1-dev
5656

5757
USER 0:0
5858

deployments/container/Makefile

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414

1515
BUILD_MULTI_ARCH_IMAGES ?= no
1616
DOCKER ?= docker
17-
BUILDX =
18-
ifeq ($(BUILD_MULTI_ARCH_IMAGES),true)
19-
BUILDX = buildx
20-
endif
2117

2218
##### Global variables #####
2319
include $(CURDIR)/versions.mk
@@ -38,8 +34,8 @@ OUT_IMAGE_VERSION ?= $(IMAGE_VERSION)
3834
OUT_IMAGE = $(OUT_IMAGE_NAME):$(OUT_IMAGE_VERSION)
3935

4036
##### Public rules #####
41-
DISTRIBUTIONS := ubi9
42-
DEFAULT_PUSH_TARGET := ubi9
37+
DISTRIBUTIONS := distroless
38+
DEFAULT_PUSH_TARGET := distroless
4339

4440
PUSH_TARGETS := $(patsubst %, push-%, $(DISTRIBUTIONS))
4541
BUILD_TARGETS := $(patsubst %, build-%, $(DISTRIBUTIONS))
@@ -53,24 +49,30 @@ else
5349
include $(CURDIR)/deployments/container/multi-arch.mk
5450
endif
5551

52+
# Both distroless and build-distroless trigger a build of the relevant image
53+
$(DISTRIBUTIONS): %: build-%
54+
5655
build-%: DOCKERFILE_SUFFIX = $(*)
5756
build-%: DOCKERFILE = $(CURDIR)/deployments/container/Dockerfile.$(DOCKERFILE_SUFFIX)
58-
59-
# Both ubi9 and build-ubi9 trigger a build of the relevant image
60-
$(DISTRIBUTIONS): %: build-%
6157
$(BUILD_TARGETS): build-%:
62-
DOCKER_BUILDKIT=1 \
63-
$(DOCKER) $(BUILDX) build --pull \
64-
$(DOCKER_BUILD_OPTIONS) \
65-
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
66-
--tag $(IMAGE) \
67-
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
68-
--build-arg VERSION="$(VERSION)" \
69-
--build-arg GIT_COMMIT="$(GIT_COMMIT)" \
70-
--build-arg CVE_UPDATES="$(CVE_UPDATES)" \
71-
--build-arg GOPROXY="$(GOPROXY)" \
72-
--file $(DOCKERFILE) \
73-
$(CURDIR)
58+
$(DOCKER) build --pull \
59+
$(DOCKER_BUILD_OPTIONS) \
60+
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
61+
--tag $(IMAGE) \
62+
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
63+
--build-arg VERSION="$(VERSION)" \
64+
--build-arg GIT_COMMIT="$(GIT_COMMIT)" \
65+
--build-arg CVE_UPDATES="$(CVE_UPDATES)" \
66+
--build-arg GOPROXY="$(GOPROXY)" \
67+
--file $(DOCKERFILE) \
68+
$(CURDIR)
69+
ifeq ($(PUSH_ON_BUILD),true)
70+
$(DOCKER) push "$(IMAGE)"
71+
endif
72+
73+
# Handle the default build target.
74+
.PHONY: build
75+
build: $(DEFAULT_PUSH_TARGET)
7476

7577
.PHONY: bump-commit
7678
BUMP_COMMIT := Bump to version $(VERSION)

deployments/container/multi-arch.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
PUSH_ON_BUILD ?= false
1616
ATTACH_ATTESTATIONS ?= false
1717
DOCKER_BUILD_OPTIONS = --output=type=image,push=$(PUSH_ON_BUILD) --provenance=$(ATTACH_ATTESTATIONS) --sbom=$(ATTACH_ATTESTATIONS)
18-
DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64,linux/arm64
18+
DOCKER_BUILD_PLATFORM_OPTIONS ?= --platform=linux/amd64,linux/arm64
1919

2020
REGCTL ?= regctl
2121
$(PUSH_TARGETS): push-%:

deployments/container/native-only.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
15+
PUSH_ON_BUILD ?= false
16+
ATTACH_ATTESTATIONS ?= false
17+
DOCKER_BUILD_PLATFORM_OPTIONS ?= --platform=linux/amd64
18+
DOCKER_BUILD_OPTIONS = --output=type=image,push=$(PUSH_ON_BUILD) --provenance=$(ATTACH_ATTESTATIONS) --sbom=$(ATTACH_ATTESTATIONS)
1619

1720
$(PUSH_TARGETS): push-%:
1821
$(DOCKER) tag "$(IMAGE)" "$(OUT_IMAGE)"

0 commit comments

Comments
 (0)