Skip to content

Commit df60096

Browse files
authored
Merge pull request #21644 from nirs/prepare-for-internal-kvm
test: fix test helper for AUX and fix SELinux build
2 parents 9ebf9fd + f16e6d9 commit df60096

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ endef
188188

189189
# $(call DOCKER, image, command)
190190
define DOCKER
191-
docker run --rm -e GOCACHE=/app/.cache -e IN_DOCKER=1 --user $(shell id -u):$(shell id -g) -w /app -v $(PWD):/app:Z -v $(GOPATH):/go --init $(1) /bin/bash -c '$(2)'
191+
docker run --rm -e GOCACHE=/app/.cache -e IN_DOCKER=1 --user $(shell id -u):$(shell id -g) -w /app -v $(PWD):/app:Z -v $(GOPATH):/go:Z --init $(1) /bin/bash -c '$(2)'
192192
endef
193193

194194
ifeq ($(BUILD_IN_DOCKER),y)
@@ -1213,7 +1213,7 @@ update-kong-ingress-controller-version:
12131213
update-nvidia-device-plugin-version:
12141214
cd hack && go run update/nvidia_device_plugin_version/nvidia_device_plugin_version.go
12151215

1216-
# for amd gpu
1216+
# for amd gpu
12171217
.PHONY: update-amd-device-plugin-version
12181218
update-amd-device-plugin-version:
12191219
cd hack && go run update/amd_device_gpu_plugin_version/amd_device_gpu_plugin_version.go

hack/jenkins/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ if [ -z "${EXTERNAL}" ]; then
500500
echo ">> uploading ${SUMMARY_OUT} to gs://${JOB_GCS_BUCKET}_summary.json"
501501
echo ">> public URL: ${REPORT_URL_BASE}/${JOB_GCS_BUCKET}_summary.json"
502502
gsutil -qm cp "${SUMMARY_OUT}" "gs://${JOB_GCS_BUCKET}_summary.json" || true
503-
else
503+
else
504504
# Otherwise, put the results in a predictable spot so the upload job can find them
505505
REPORTS_PATH=test_reports
506506
mkdir -p "$REPORTS_PATH"

site/content/en/docs/tutorials/nvidia.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ date: 2018-01-02
4646
minikube delete
4747
```
4848
This will make sure minikube does any required setup or addon installs now that the nvidia runtime is available.
49-
49+
5050
- Start minikube with one of:
5151
- The NVIDIA Container Toolkit
5252
```shell
@@ -154,7 +154,7 @@ drivers supported by minikube for macOS doesn't support GPU passthrough:
154154
- [moby/hyperkit#159](https://github.com/moby/hyperkit/issues/159)
155155
- [VirtualBox docs](https://www.virtualbox.org/manual/ch09.html#pcipassthrough)
156156
157-
Also:
157+
Also:
158158
159159
- For quite a while, all Mac hardware (both laptops and desktops) have come with
160160
Intel or AMD GPUs (and not with NVIDIA GPUs). Recently, Apple added [support

test/integration/main_test.go

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,32 +134,32 @@ func Target() string {
134134

135135
// NoneDriver returns whether or not this test is using the none driver
136136
func NoneDriver() bool {
137-
return strings.Contains(*startArgs, "--driver=none") || strings.Contains(*startArgs, "--vm-driver=none")
137+
return matchDriverFlag("none")
138138
}
139139

140140
// HyperVDriver returns whether or not this test is using the Hyper-V driver
141141
func HyperVDriver() bool {
142-
return strings.Contains(*startArgs, "--driver=hyperv") || strings.Contains(*startArgs, "--vm-driver=hyperv")
142+
return matchDriverFlag("hyperv")
143143
}
144144

145145
// KVM returns true is is KVM driver
146146
func KVMDriver() bool {
147-
return strings.Contains(*startArgs, "--driver=kvm") || strings.Contains(*startArgs, "--vm-driver=kvm") || strings.Contains(*startArgs, "--driver=kvm2") || strings.Contains(*startArgs, "--vm-driver=kvm2")
147+
return matchDriverFlag("kvm", "kvm2")
148148
}
149149

150150
// VirtualboxDriver returns whether or not this test is using the VirtualBox driver
151151
func VirtualboxDriver() bool {
152-
return strings.Contains(*startArgs, "--driver=virtualbox") || strings.Contains(*startArgs, "--vm-driver=virtualbox")
152+
return matchDriverFlag("virtualbox")
153153
}
154154

155155
// DockerDriver returns whether or not this test is using the docker or podman driver
156156
func DockerDriver() bool {
157-
return strings.Contains(*startArgs, "--driver=docker") || strings.Contains(*startArgs, "--vm-driver=docker")
157+
return matchDriverFlag("docker")
158158
}
159159

160160
// PodmanDriver returns whether or not this test is using the docker or podman driver
161161
func PodmanDriver() bool {
162-
return strings.Contains(*startArgs, "--driver=podman") || strings.Contains(*startArgs, "--vm-driver=podman")
162+
return matchDriverFlag("podman")
163163
}
164164

165165
// RootlessDriver returns whether or not this test is using the rootless KIC driver
@@ -172,9 +172,13 @@ func KicDriver() bool {
172172
return DockerDriver() || PodmanDriver()
173173
}
174174

175+
func HyperkitDriver() bool {
176+
return matchDriverFlag("hyperkit")
177+
}
178+
175179
// NeedsAuxDriver Returns true if the driver needs an auxiliary driver (kvm, hyperkit,..)
176180
func NeedsAuxDriver() bool {
177-
return HyperVDriver() || KVMDriver()
181+
return HyperkitDriver() || KVMDriver()
178182
}
179183

180184
// VMDriver checks if the driver is a VM
@@ -228,3 +232,15 @@ func Seconds(n int) time.Duration {
228232
func TestingKicBaseImage() bool {
229233
return strings.Contains(*startArgs, "base-image")
230234
}
235+
236+
func matchDriverFlag(names ...string) bool {
237+
args := *startArgs
238+
for _, name := range names {
239+
for _, prefix := range []string{"--driver=", "--vm-driver="} {
240+
if strings.Contains(args, prefix+name) {
241+
return true
242+
}
243+
}
244+
}
245+
return false
246+
}

0 commit comments

Comments
 (0)