Merge pull request #21625 from nirs/kvm-driver-internal
kvm: remove dependency on external driverpull/21777/head
commit
6e576023ec
150
Makefile
150
Makefile
|
|
@ -33,7 +33,7 @@ DEB_REVISION ?= 0
|
|||
RPM_VERSION ?= $(DEB_VERSION)
|
||||
RPM_REVISION ?= 0
|
||||
|
||||
# used by hack/jenkins/release_build_and_upload.sh and KVM_BUILD_IMAGE, see also BUILD_IMAGE below
|
||||
# used by hack/jenkins/release_build_and_upload.sh, see also BUILD_IMAGE below
|
||||
# update this only by running `make update-golang-version`
|
||||
GO_VERSION ?= 1.24.6
|
||||
# set GOTOOLCHAIN to GO_VERSION to override any toolchain version specified in
|
||||
|
|
@ -42,10 +42,6 @@ export GOTOOLCHAIN := go$(GO_VERSION)
|
|||
# update this only by running `make update-golang-version`
|
||||
GO_K8S_VERSION_PREFIX ?= v1.34.0
|
||||
|
||||
# replace "x.y.0" => "x.y". kube-cross and go.dev/dl use different formats for x.y.0 go versions
|
||||
KVM_GO_VERSION ?= $(GO_VERSION:.0=)
|
||||
|
||||
|
||||
INSTALL_SIZE ?= $(shell du out/minikube-windows-amd64.exe | cut -f1)
|
||||
BUILDROOT_BRANCH ?= 2025.02
|
||||
# the go version on the line below is for the ISO
|
||||
|
|
@ -69,9 +65,6 @@ BUILD_IMAGE ?= registry.k8s.io/build-image/kube-cross:$(GO_K8S_VERSION_PREFIX)-
|
|||
|
||||
ISO_BUILD_IMAGE ?= $(REGISTRY)/buildroot-image
|
||||
|
||||
KVM_BUILD_IMAGE_AMD64 ?= $(REGISTRY)/kvm-build-image_amd64:$(KVM_GO_VERSION)
|
||||
KVM_BUILD_IMAGE_ARM64 ?= $(REGISTRY)/kvm-build-image_arm64:$(KVM_GO_VERSION)
|
||||
|
||||
ISO_BUCKET ?= minikube/iso
|
||||
|
||||
MINIKUBE_VERSION ?= $(ISO_VERSION)
|
||||
|
|
@ -147,7 +140,11 @@ MARKDOWNLINT ?= markdownlint
|
|||
|
||||
MINIKUBE_MARKDOWN_FILES := README.md CONTRIBUTING.md CHANGELOG.md
|
||||
|
||||
MINIKUBE_BUILD_TAGS :=
|
||||
# The `libvirt_dlopen` build tag is used only linux to avoid linking with
|
||||
# libvirt shared library. This is not documnted but can be found in the source.
|
||||
# https://gitlab.com/libvirt/libvirt-go-module/-/blob/f7cdeba9979dd248582901d2aaf7ab1f2d27cbe0/domain.go#L30
|
||||
MINIKUBE_BUILD_TAGS := libvirt_dlopen
|
||||
|
||||
MINIKUBE_INTEGRATION_BUILD_TAGS := integration $(MINIKUBE_BUILD_TAGS)
|
||||
|
||||
CMD_SOURCE_DIRS = cmd pkg deploy/addons translations
|
||||
|
|
@ -160,9 +157,6 @@ ADDON_FILES = $(shell find "deploy/addons" -type f | grep -v "\.go")
|
|||
TRANSLATION_FILES = $(shell find "translations" -type f | grep -v "\.go")
|
||||
ASSET_FILES = $(ADDON_FILES) $(TRANSLATION_FILES)
|
||||
|
||||
# kvm2 ldflags
|
||||
KVM2_LDFLAGS := -X k8s.io/minikube/pkg/drivers/kvm.version=$(VERSION) -X k8s.io/minikube/pkg/drivers/kvm.gitCommitID=$(COMMIT)
|
||||
|
||||
# hyperkit ldflags
|
||||
HYPERKIT_LDFLAGS := -X k8s.io/minikube/pkg/drivers/hyperkit.version=$(VERSION) -X k8s.io/minikube/pkg/drivers/hyperkit.gitCommitID=$(COMMIT)
|
||||
|
||||
|
|
@ -362,18 +356,11 @@ all: cross drivers e2e-cross cross-tars exotic retro out/gvisor-addon ## Build a
|
|||
|
||||
# After https://github.com/kubernetes/minikube/issues/19959 is fixed kvm2-arm64 can be added back
|
||||
.PHONY: drivers
|
||||
drivers: ## Build Hyperkit and KVM2 drivers
|
||||
drivers: docker-machine-driver-hyperkit \
|
||||
docker-machine-driver-kvm2 \
|
||||
out/docker-machine-driver-kvm2-amd64
|
||||
|
||||
drivers: docker-machine-driver-hyperkit ## Build external drivers
|
||||
|
||||
.PHONY: docker-machine-driver-hyperkit
|
||||
docker-machine-driver-hyperkit: out/docker-machine-driver-hyperkit ## Build Hyperkit driver
|
||||
|
||||
.PHONY: docker-machine-driver-kvm2
|
||||
docker-machine-driver-kvm2: out/docker-machine-driver-kvm2 ## Build KVM2 driver
|
||||
|
||||
.PHONY: integration
|
||||
integration: out/minikube$(IS_EXE) ## Trigger minikube integration test, logs to ./out/testout_COMMIT.txt
|
||||
go test -ldflags="${MINIKUBE_LDFLAGS}" -v -test.timeout=90m $(INTEGRATION_TESTS_TO_RUN) --tags="$(MINIKUBE_INTEGRATION_BUILD_TAGS)" $(TEST_ARGS) 2>&1 | tee "./out/testout_$(COMMIT_SHORT).txt"
|
||||
|
|
@ -473,7 +460,6 @@ checksum: ## Generate checksums
|
|||
for f in out/minikube-amd64.iso out/minikube-arm64.iso out/minikube-linux-amd64 out/minikube-linux-arm \
|
||||
out/minikube-linux-arm64 out/minikube-linux-ppc64le out/minikube-linux-s390x \
|
||||
out/minikube-darwin-amd64 out/minikube-darwin-arm64 out/minikube-windows-amd64.exe \
|
||||
out/docker-machine-driver-kvm2 out/docker-machine-driver-kvm2-amd64 out/docker-machine-driver-kvm2-arm64 \
|
||||
out/docker-machine-driver-hyperkit; do \
|
||||
if [ -f "$${f}" ]; then \
|
||||
openssl sha256 "$${f}" | awk '{print $$2}' > "$${f}.sha256" ; \
|
||||
|
|
@ -532,9 +518,9 @@ out/linters/golangci-lint-$(GOLINT_VERSION):
|
|||
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
|
||||
lint:
|
||||
docker run --rm -v `pwd`:/app:Z -w /app golangci/golangci-lint:$(GOLINT_VERSION) \
|
||||
golangci-lint run ${GOLINT_OPTIONS} ./..."
|
||||
# --skip-dirs "cmd/drivers/kvm|cmd/drivers/hyperkit|pkg/drivers/kvm|pkg/drivers/hyperkit"
|
||||
# The "--skip-dirs" parameter is no longer supported in the V2 version. If you need to skip the directory,
|
||||
golangci-lint run ${GOLINT_OPTIONS} ./..."
|
||||
# --skip-dirs "cmd/drivers/kvm|cmd/drivers/hyperkit|pkg/drivers/kvm|pkg/drivers/hyperkit"
|
||||
# The "--skip-dirs" parameter is no longer supported in the V2 version. If you need to skip the directory,
|
||||
# add it under "linters.settings.exclusions.paths" in the ".golangci.yaml" file.
|
||||
else
|
||||
lint: out/linters/golangci-lint-$(GOLINT_VERSION) ## Run lint
|
||||
|
|
@ -567,10 +553,7 @@ out/docs/minikube.md: $(shell find "cmd") $(shell find "pkg/minikube/constants")
|
|||
|
||||
.PHONY: debs ## Build all deb packages
|
||||
debs: out/minikube_$(DEB_VERSION)-$(DEB_REVISION)_amd64.deb \
|
||||
out/minikube_$(DEB_VERSION)-$(DEB_REVISION)_arm64.deb \
|
||||
out/docker-machine-driver-kvm2_$(DEB_VERSION).deb \
|
||||
out/docker-machine-driver-kvm2_$(DEB_VERSION)-$(DEB_REVISION)_amd64.deb
|
||||
# out/docker-machine-driver-kvm2_$(DEB_VERSION)-$(DEB_REVISION)_arm64.deb
|
||||
out/minikube_$(DEB_VERSION)-$(DEB_REVISION)_arm64.deb
|
||||
|
||||
.PHONY: deb_version
|
||||
deb_version:
|
||||
|
|
@ -634,8 +617,8 @@ out/repodata/repomd.xml: out/minikube-$(RPM_VERSION).rpm
|
|||
-u "$(MINIKUBE_RELEASES_URL)/$(VERSION)/" out
|
||||
|
||||
.SECONDEXPANSION:
|
||||
TAR_TARGETS_linux-amd64 := out/minikube-linux-amd64 out/docker-machine-driver-kvm2
|
||||
TAR_TARGETS_linux-arm64 := out/minikube-linux-arm64 #out/docker-machine-driver-kvm2
|
||||
TAR_TARGETS_linux-amd64 := out/minikube-linux-amd64
|
||||
TAR_TARGETS_linux-arm64 := out/minikube-linux-arm64
|
||||
TAR_TARGETS_darwin-amd64 := out/minikube-darwin-amd64 out/docker-machine-driver-hyperkit
|
||||
TAR_TARGETS_darwin-arm64 := out/minikube-darwin-arm64 #out/docker-machine-driver-hyperkit
|
||||
TAR_TARGETS_windows-amd64 := out/minikube-windows-amd64.exe
|
||||
|
|
@ -847,113 +830,6 @@ update-leaderboard:
|
|||
update-yearly-leaderboard:
|
||||
hack/yearly-leaderboard.sh
|
||||
|
||||
out/docker-machine-driver-kvm2: out/docker-machine-driver-kvm2-$(GOARCH)
|
||||
# skipping kvm2-arm64 till https://github.com/kubernetes/minikube/issues/19959 is fixed
|
||||
ifneq ($(GOARCH),arm64)
|
||||
$(if $(quiet),@echo " CP $@")
|
||||
$(Q)cp $< $@
|
||||
endif
|
||||
|
||||
out/docker-machine-driver-kvm2-x86_64: out/docker-machine-driver-kvm2-amd64
|
||||
$(if $(quiet),@echo " CP $@")
|
||||
$(Q)cp $< $@
|
||||
|
||||
# https://github.com/kubernetes/minikube/issues/19959
|
||||
out/docker-machine-driver-kvm2-aarch64: out/docker-machine-driver-kvm2-arm64
|
||||
$(if $(quiet),@echo " CP $@")
|
||||
$(Q)cp $< $@
|
||||
|
||||
|
||||
out/docker-machine-driver-kvm2_$(DEB_VERSION).deb: out/docker-machine-driver-kvm2_$(DEB_VERSION)-0_amd64.deb
|
||||
cp $< $@
|
||||
|
||||
out/docker-machine-driver-kvm2_$(DEB_VERSION)-0_%.deb: out/docker-machine-driver-kvm2-%
|
||||
cp -r installers/linux/deb/kvm2_deb_template out/docker-machine-driver-kvm2_$(DEB_VERSION)
|
||||
chmod 0755 out/docker-machine-driver-kvm2_$(DEB_VERSION)/DEBIAN
|
||||
sed -E -i -e 's/--VERSION--/$(DEB_VERSION)/g' out/docker-machine-driver-kvm2_$(DEB_VERSION)/DEBIAN/control
|
||||
sed -E -i -e 's/--ARCH--/'$*'/g' out/docker-machine-driver-kvm2_$(DEB_VERSION)/DEBIAN/control
|
||||
mkdir -p out/docker-machine-driver-kvm2_$(DEB_VERSION)/usr/bin
|
||||
cp $< out/docker-machine-driver-kvm2_$(DEB_VERSION)/usr/bin/docker-machine-driver-kvm2
|
||||
fakeroot dpkg-deb --build out/docker-machine-driver-kvm2_$(DEB_VERSION) $@
|
||||
rm -rf out/docker-machine-driver-kvm2_$(DEB_VERSION)
|
||||
|
||||
out/docker-machine-driver-kvm2-$(RPM_VERSION).rpm: out/docker-machine-driver-kvm2-$(RPM_VERSION)-0.x86_64.rpm
|
||||
cp $< $@
|
||||
|
||||
out/docker-machine-driver-kvm2_$(RPM_VERSION).amd64.rpm: out/docker-machine-driver-kvm2-$(RPM_VERSION)-0.x86_64.rpm
|
||||
cp $< $@
|
||||
|
||||
out/docker-machine-driver-kvm2_$(RPM_VERSION).arm64.rpm: out/docker-machine-driver-kvm2-$(RPM_VERSION)-0.aarch64.rpm
|
||||
cp $< $@
|
||||
|
||||
out/docker-machine-driver-kvm2-$(RPM_VERSION)-0.%.rpm: out/docker-machine-driver-kvm2-%
|
||||
cp -r installers/linux/rpm/kvm2_rpm_template out/docker-machine-driver-kvm2-$(RPM_VERSION)
|
||||
sed -E -i -e 's/--VERSION--/'$(RPM_VERSION)'/g' out/docker-machine-driver-kvm2-$(RPM_VERSION)/docker-machine-driver-kvm2.spec
|
||||
sed -E -i -e 's|--OUT--|'$(PWD)/out'|g' out/docker-machine-driver-kvm2-$(RPM_VERSION)/docker-machine-driver-kvm2.spec
|
||||
rpmbuild -bb -D "_rpmdir $(PWD)/out" --target $* \
|
||||
out/docker-machine-driver-kvm2-$(RPM_VERSION)/docker-machine-driver-kvm2.spec
|
||||
@mv out/$*/docker-machine-driver-kvm2-$(RPM_VERSION)-0.$*.rpm out/ && rmdir out/$*
|
||||
rm -rf out/docker-machine-driver-kvm2-$(RPM_VERSION)
|
||||
|
||||
.PHONY: kvm-image-amd64
|
||||
kvm-image-amd64: installers/linux/kvm/Dockerfile.amd64 ## Convenient alias to build the docker container
|
||||
docker build --build-arg "GO_VERSION=$(GO_VERSION)" -t $(KVM_BUILD_IMAGE_AMD64) -f $< $(dir $<)
|
||||
@echo ""
|
||||
@echo "$(@) successfully built"
|
||||
|
||||
.PHONY: kvm-image-arm64
|
||||
kvm-image-arm64: installers/linux/kvm/Dockerfile.arm64 docker-multi-arch-build ## Convenient alias to build the docker container
|
||||
docker buildx build --platform linux/arm64 --build-arg "GO_VERSION=$(GO_VERSION)" -t $(KVM_BUILD_IMAGE_ARM64) -f $< $(dir $<)
|
||||
@echo ""
|
||||
@echo "$(@) successfully built"
|
||||
|
||||
kvm_in_docker:
|
||||
docker image inspect -f '{{.Id}} {{.RepoTags}}' $(KVM_BUILD_IMAGE_AMD64) || $(MAKE) kvm-image-amd64
|
||||
rm -f out/docker-machine-driver-kvm2
|
||||
$(call DOCKER,$(KVM_BUILD_IMAGE_AMD64),/usr/bin/make out/docker-machine-driver-kvm2 COMMIT=$(COMMIT))
|
||||
|
||||
.PHONY: install-kvm-driver
|
||||
install-kvm-driver: out/docker-machine-driver-kvm2 ## Install KVM Driver
|
||||
mkdir -p $(GOBIN)
|
||||
cp out/docker-machine-driver-kvm2 $(GOBIN)/docker-machine-driver-kvm2
|
||||
|
||||
|
||||
out/docker-machine-driver-kvm2-arm64:
|
||||
@echo "skipping kvm2-arm64 till https://github.com/kubernetes/minikube/issues/19959 is fixed"
|
||||
# ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
|
||||
# docker image inspect -f '{{.Id}} {{.RepoTags}}' $(KVM_BUILD_IMAGE_ARM64) || $(MAKE) kvm-image-arm64
|
||||
# $(call DOCKER,$(KVM_BUILD_IMAGE_ARM64),/usr/bin/make $@ COMMIT=$(COMMIT))
|
||||
# else
|
||||
# $(if $(quiet),@echo " GO $@")
|
||||
# $(Q)GOARCH=arm64 \
|
||||
# go build \
|
||||
# -buildvcs=false \
|
||||
# -installsuffix "static" \
|
||||
# -ldflags="$(KVM2_LDFLAGS)" \
|
||||
# -tags "libvirt_without_lxc" \
|
||||
# -o $@ \
|
||||
# k8s.io/minikube/cmd/drivers/kvm
|
||||
# endif
|
||||
# chmod +X $@
|
||||
|
||||
out/docker-machine-driver-kvm2-%:
|
||||
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
|
||||
docker image inspect -f '{{.Id}} {{.RepoTags}}' $(KVM_BUILD_IMAGE_AMD64) || $(MAKE) kvm-image-amd64
|
||||
$(call DOCKER,$(KVM_BUILD_IMAGE_AMD64),/usr/bin/make $@ COMMIT=$(COMMIT))
|
||||
else
|
||||
$(if $(quiet),@echo " GO $@")
|
||||
$(Q)GOARCH=$* \
|
||||
go build \
|
||||
-buildvcs=false \
|
||||
-installsuffix "static" \
|
||||
-ldflags="$(KVM2_LDFLAGS)" \
|
||||
-tags "libvirt_without_lxc" \
|
||||
-o $@ \
|
||||
k8s.io/minikube/cmd/drivers/kvm
|
||||
endif
|
||||
chmod +X $@
|
||||
|
||||
|
||||
site/themes/docsy/assets/vendor/bootstrap/package.js: ## update the website docsy theme git submodule
|
||||
git submodule update -f --init
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
//go:build !linux
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println(
|
||||
"this driver was built on a non-linux machine, so it is " +
|
||||
"unavailable. Please re-build minikube on a linux machine to enable " +
|
||||
"it.",
|
||||
)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
//go:build linux
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers/plugin"
|
||||
"k8s.io/minikube/pkg/drivers/kvm"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) > 1 && os.Args[1] == "version" {
|
||||
fmt.Println("version:", kvm.GetVersion())
|
||||
fmt.Println("commit:", kvm.GetGitCommitID())
|
||||
return
|
||||
}
|
||||
|
||||
plugin.RegisterDriver(kvm.NewDriver("", ""))
|
||||
}
|
||||
|
|
@ -176,18 +176,22 @@ echo
|
|||
echo ">> Downloading test inputs from ${MINIKUBE_LOCATION} ..."
|
||||
gsutil -qm cp \
|
||||
"gs://minikube-builds/${MINIKUBE_LOCATION}/minikube-${OS_ARCH}" \
|
||||
"gs://minikube-builds/${MINIKUBE_LOCATION}/docker-machine-driver"-* \
|
||||
"gs://minikube-builds/${MINIKUBE_LOCATION}/e2e-${OS_ARCH}" out
|
||||
"gs://minikube-builds/${MINIKUBE_LOCATION}/e2e-${OS_ARCH}" \
|
||||
out
|
||||
|
||||
gsutil -qm cp -r "gs://minikube-builds/${MINIKUBE_LOCATION}/testdata"/* testdata/
|
||||
|
||||
gsutil -qm cp "gs://minikube-builds/${MINIKUBE_LOCATION}/gvisor-addon" testdata/
|
||||
|
||||
if [[ "${DRIVER}" == "hyperkit" ]]; then
|
||||
gsutil -qm cp "gs://minikube-builds/${MINIKUBE_LOCATION}/docker-machine-driver-hyperkit" out
|
||||
chmod +x out/docker-machine-driver-hyperkit
|
||||
fi
|
||||
|
||||
# Set the executable bit on the e2e binary and out binary
|
||||
export MINIKUBE_BIN="out/minikube-${OS_ARCH}"
|
||||
export E2E_BIN="out/e2e-${OS_ARCH}"
|
||||
chmod +x "${MINIKUBE_BIN}" "${E2E_BIN}" out/docker-machine-driver-*
|
||||
chmod +x "${MINIKUBE_BIN}" "${E2E_BIN}"
|
||||
"${MINIKUBE_BIN}" version
|
||||
|
||||
procs=$(pgrep "minikube-${OS_ARCH}|e2e-${OS_ARCH}" || true)
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ make -j 16 \
|
|||
out/mkcmp \
|
||||
out/minikube_${DEB_VER}_amd64.deb \
|
||||
out/minikube_${DEB_VER}_arm64.deb \
|
||||
out/docker-machine-driver-kvm2_$(make deb_version_base).deb \
|
||||
out/docker-machine-driver-kvm2_${DEB_VER}_amd64.deb \
|
||||
&& failed=$? || failed=$?
|
||||
|
||||
BUILT_VERSION=$("out/minikube-$(go env GOOS)-$(go env GOARCH)" version)
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ env BUILD_IN_DOCKER=y \
|
|||
"out/minikube_${DEB_VERSION}-${DEB_REVISION}_armhf.deb" \
|
||||
"out/minikube_${DEB_VERSION}-${DEB_REVISION}_ppc64el.deb" \
|
||||
"out/minikube_${DEB_VERSION}-${DEB_REVISION}_s390x.deb" \
|
||||
"out/docker-machine-driver-kvm2_${DEB_VERSION}-${DEB_REVISION}_amd64.deb"
|
||||
# "out/docker-machine-driver-kvm2_${DEB_VERSION}-${DEB_REVISION}_arm64.deb"
|
||||
|
||||
env BUILD_IN_DOCKER=y \
|
||||
make \
|
||||
|
|
@ -74,7 +72,6 @@ env BUILD_IN_DOCKER=y \
|
|||
"out/minikube-${RPM_VERSION}-${RPM_REVISION}.armv7hl.rpm" \
|
||||
"out/minikube-${RPM_VERSION}-${RPM_REVISION}.ppc64le.rpm" \
|
||||
"out/minikube-${RPM_VERSION}-${RPM_REVISION}.s390x.rpm" \
|
||||
"out/docker-machine-driver-kvm2-${RPM_VERSION}-${RPM_REVISION}.x86_64.rpm"
|
||||
|
||||
# check if 'commit: <commit-id>' line contains '-dirty' commit suffix
|
||||
BUILT_VERSION="$(out/minikube-$(go env GOOS)-$(go env GOARCH) version)"
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
pkgbase = docker-machine-driver-kvm2
|
||||
pkgdesc = Minikube-maintained KVM driver for docker-machine
|
||||
pkgver = $PKG_VERSION
|
||||
pkgrel = 1
|
||||
url = https://github.com/kubernetes/minikube
|
||||
arch = x86_64
|
||||
license = Apache-2.0
|
||||
depends = docker-machine
|
||||
depends = libvirt
|
||||
depends = ebtables
|
||||
depends = dnsmasq
|
||||
optdepends = docker: to manage the containers in the machine
|
||||
source = https://github.com/kubernetes/minikube/releases/download/v$PKG_VERSION/docker-machine-driver-kvm2
|
||||
sha256sums = $MINIKUBE_DRIVER_KVM_SHA256
|
||||
|
||||
pkgname = docker-machine-driver-kvm2
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
# Maintainer: Brad Erhart <brae.04+aur@gmail.com>
|
||||
# Contributor: Matt Rickard <mrick@google.com>
|
||||
pkgname=docker-machine-driver-kvm2
|
||||
pkgver=$PKG_VERSION
|
||||
pkgrel=1
|
||||
pkgdesc="Minikube-maintained KVM driver for docker-machine"
|
||||
url="https://github.com/kubernetes/minikube"
|
||||
license=('Apache-2.0')
|
||||
arch=('x86_64')
|
||||
depends=(
|
||||
'docker-machine'
|
||||
'libvirt'
|
||||
'ebtables'
|
||||
'dnsmasq'
|
||||
)
|
||||
optdepends=(
|
||||
'docker: to manage the containers in the machine'
|
||||
)
|
||||
makedepends=()
|
||||
|
||||
source=("https://github.com/kubernetes/minikube/releases/download/v$pkgver/docker-machine-driver-kvm2")
|
||||
sha256sums=('$MINIKUBE_DRIVER_KVM_SHA256')
|
||||
|
||||
package() {
|
||||
cd "$srcdir"
|
||||
install -d "$pkgdir/usr/bin"
|
||||
install -m755 docker-machine-driver-kvm2 "$pkgdir/usr/bin/docker-machine-driver-kvm2"
|
||||
}
|
||||
|
|
@ -15,7 +15,6 @@ depends=(
|
|||
optdepends=(
|
||||
'kubectl-bin: to manage the cluster'
|
||||
'virtualbox'
|
||||
'docker-machine-driver-kvm2'
|
||||
)
|
||||
makedepends=()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
Package: docker-machine-driver-kvm2
|
||||
Version: --VERSION--
|
||||
Section: base
|
||||
Priority: optional
|
||||
Architecture: --ARCH--
|
||||
Depends: libvirt0 (>= 1.3.1)
|
||||
Recommends: minikube
|
||||
Maintainer: Thomas Strömberg <t+minikube@stromberg.org>
|
||||
Description: Machine driver for KVM
|
||||
minikube uses Docker Machine to manage the Kubernetes VM so it benefits
|
||||
from the driver plugin architecture that Docker Machine uses to provide
|
||||
a consistent way to manage various VM providers.
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
# Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
gcc \
|
||||
libc6-dev \
|
||||
make \
|
||||
pkg-config \
|
||||
curl \
|
||||
libvirt-dev \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG GO_VERSION
|
||||
|
||||
RUN curl -sSL https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xzf -
|
||||
|
||||
ENV GOPATH=/go
|
||||
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/go/bin
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
# Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
gcc \
|
||||
libc6-dev \
|
||||
make \
|
||||
pkg-config \
|
||||
curl \
|
||||
libvirt-dev \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG GO_VERSION
|
||||
|
||||
RUN curl -sSL https://go.dev/dl/go${GO_VERSION}.linux-arm64.tar.gz | tar -C /usr/local -xzf -
|
||||
|
||||
ENV GOPATH=/go
|
||||
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/go/bin
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
Name: docker-machine-driver-kvm2
|
||||
Version: --VERSION--
|
||||
Release: 0
|
||||
Summary: Machine driver for KVM
|
||||
License: ASL 2.0
|
||||
Group: Development/Tools
|
||||
URL: https://github.com/kubernetes/minikube
|
||||
#Requires: <determined automatically by rpm>
|
||||
|
||||
# Needed for older versions of RPM
|
||||
BuildRoot: %{_tmppath}%{name}-buildroot
|
||||
|
||||
%description
|
||||
Minikube uses Docker Machine to manage the Kubernetes VM so it benefits
|
||||
from the driver plugin architecture that Docker Machine uses to provide
|
||||
a consistent way to manage various VM providers.
|
||||
|
||||
%prep
|
||||
mkdir -p %{name}-%{version}
|
||||
cd %{name}-%{version}
|
||||
cp --OUT--/docker-machine-driver-kvm2-%{_arch} docker-machine-driver-kvm2
|
||||
|
||||
%install
|
||||
cd %{name}-%{version}
|
||||
mkdir -p %{buildroot}%{_bindir}
|
||||
install -m 755 docker-machine-driver-kvm2 %{buildroot}%{_bindir}/%{name}
|
||||
|
||||
%files
|
||||
%{_bindir}/%{name}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
//go:build linux
|
||||
//go:build linux && amd64
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,107 @@
|
|||
//go:build linux
|
||||
|
||||
/*
|
||||
Copyright 2025 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package kvm
|
||||
|
||||
import (
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"k8s.io/minikube/pkg/drivers/common"
|
||||
)
|
||||
|
||||
const (
|
||||
qemusystem = "qemu:///system"
|
||||
defaultPrivateNetworkName = "minikube-net"
|
||||
defaultNetworkName = "default"
|
||||
)
|
||||
|
||||
// Driver is the machine driver for KVM
|
||||
type Driver struct {
|
||||
*drivers.BaseDriver
|
||||
*common.CommonDriver
|
||||
|
||||
// How much memory, in MB, to allocate to the VM
|
||||
Memory int
|
||||
|
||||
// How many cpus to allocate to the VM
|
||||
CPU int
|
||||
|
||||
// The name of the default network
|
||||
Network string
|
||||
|
||||
// The name of the private network
|
||||
PrivateNetwork string
|
||||
|
||||
// The size of the disk to be created for the VM, in MB
|
||||
DiskSize int
|
||||
|
||||
// The path of the disk .img
|
||||
DiskPath string
|
||||
|
||||
// A file or network URI to fetch the minikube ISO
|
||||
Boot2DockerURL string
|
||||
|
||||
// The location of the iso to boot from
|
||||
ISO string
|
||||
|
||||
// The randomly generated MAC Address
|
||||
// If empty, a random MAC will be generated.
|
||||
MAC string
|
||||
|
||||
// The randomly generated MAC Address for the NIC attached to the private network
|
||||
// If empty, a random MAC will be generated.
|
||||
PrivateMAC string
|
||||
|
||||
// Whether to passthrough GPU devices from the host to the VM.
|
||||
GPU bool
|
||||
|
||||
// Whether to hide the KVM hypervisor signature from the guest
|
||||
Hidden bool
|
||||
|
||||
// XML that needs to be added to passthrough GPU devices.
|
||||
DevicesXML string
|
||||
|
||||
// QEMU Connection URI
|
||||
ConnectionURI string
|
||||
|
||||
// NUMA node count default value is 1
|
||||
NUMANodeCount int
|
||||
|
||||
// NUMA XML
|
||||
NUMANodeXML string
|
||||
|
||||
// Extra Disks
|
||||
ExtraDisks int
|
||||
|
||||
// Extra Disks XML
|
||||
ExtraDisksXML []string
|
||||
}
|
||||
|
||||
// NewDriver creates a new driver for a host
|
||||
func NewDriver(hostName, storePath string) *Driver {
|
||||
return &Driver{
|
||||
BaseDriver: &drivers.BaseDriver{
|
||||
MachineName: hostName,
|
||||
StorePath: storePath,
|
||||
SSHUser: "docker",
|
||||
},
|
||||
CommonDriver: &common.CommonDriver{},
|
||||
PrivateNetwork: defaultPrivateNetworkName,
|
||||
Network: defaultNetworkName,
|
||||
ConnectionURI: qemusystem,
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
//go:build linux
|
||||
//go:build linux && amd64
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
|
@ -34,89 +34,6 @@ import (
|
|||
"libvirt.org/go/libvirt"
|
||||
)
|
||||
|
||||
// Driver is the machine driver for KVM
|
||||
type Driver struct {
|
||||
*drivers.BaseDriver
|
||||
*common.CommonDriver
|
||||
|
||||
// How much memory, in MB, to allocate to the VM
|
||||
Memory int
|
||||
|
||||
// How many cpus to allocate to the VM
|
||||
CPU int
|
||||
|
||||
// The name of the default network
|
||||
Network string
|
||||
|
||||
// The name of the private network
|
||||
PrivateNetwork string
|
||||
|
||||
// The size of the disk to be created for the VM, in MB
|
||||
DiskSize int
|
||||
|
||||
// The path of the disk .img
|
||||
DiskPath string
|
||||
|
||||
// A file or network URI to fetch the minikube ISO
|
||||
Boot2DockerURL string
|
||||
|
||||
// The location of the iso to boot from
|
||||
ISO string
|
||||
|
||||
// The randomly generated MAC Address
|
||||
// If empty, a random MAC will be generated.
|
||||
MAC string
|
||||
|
||||
// The randomly generated MAC Address for the NIC attached to the private network
|
||||
// If empty, a random MAC will be generated.
|
||||
PrivateMAC string
|
||||
|
||||
// Whether to passthrough GPU devices from the host to the VM.
|
||||
GPU bool
|
||||
|
||||
// Whether to hide the KVM hypervisor signature from the guest
|
||||
Hidden bool
|
||||
|
||||
// XML that needs to be added to passthrough GPU devices.
|
||||
DevicesXML string
|
||||
|
||||
// QEMU Connection URI
|
||||
ConnectionURI string
|
||||
|
||||
// NUMA node count default value is 1
|
||||
NUMANodeCount int
|
||||
|
||||
// NUMA XML
|
||||
NUMANodeXML string
|
||||
|
||||
// Extra Disks
|
||||
ExtraDisks int
|
||||
|
||||
// Extra Disks XML
|
||||
ExtraDisksXML []string
|
||||
}
|
||||
|
||||
const (
|
||||
qemusystem = "qemu:///system"
|
||||
defaultPrivateNetworkName = "minikube-net"
|
||||
defaultNetworkName = "default"
|
||||
)
|
||||
|
||||
// NewDriver creates a new driver for a host
|
||||
func NewDriver(hostName, storePath string) *Driver {
|
||||
return &Driver{
|
||||
BaseDriver: &drivers.BaseDriver{
|
||||
MachineName: hostName,
|
||||
StorePath: storePath,
|
||||
SSHUser: "docker",
|
||||
},
|
||||
CommonDriver: &common.CommonDriver{},
|
||||
PrivateNetwork: defaultPrivateNetworkName,
|
||||
Network: defaultNetworkName,
|
||||
ConnectionURI: qemusystem,
|
||||
}
|
||||
}
|
||||
|
||||
// GetURL returns a Docker URL inside this host
|
||||
// e.g. tcp://1.2.3.4:2376
|
||||
// more info https://github.com/docker/machine/blob/b170508bf44c3405e079e26d5fdffe35a64c6972/libmachine/provision/utils.go#L159_L175
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
//go:build linux && !amd64
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package kvm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/docker/machine/libmachine/mcnflag"
|
||||
"github.com/docker/machine/libmachine/state"
|
||||
)
|
||||
|
||||
// This is a stub driver for unsupported architectures. All function fail with
|
||||
// notSupported error or return an zero value.
|
||||
|
||||
var notSupported = fmt.Errorf("the kvm driver is not supported on %q", runtime.GOARCH)
|
||||
|
||||
func (d *Driver) Create() error { return notSupported }
|
||||
func (d *Driver) GetCreateFlags() []mcnflag.Flag { return nil }
|
||||
func (d *Driver) GetIP() (string, error) { return "", notSupported }
|
||||
func (d *Driver) GetMachineName() string { return "" }
|
||||
func (d *Driver) GetSSHHostname() (string, error) { return "", notSupported }
|
||||
func (d *Driver) GetSSHKeyPath() string { return "" }
|
||||
func (d *Driver) GetSSHPort() (int, error) { return 0, notSupported }
|
||||
func (d *Driver) GetSSHUsername() string { return "" }
|
||||
func (d *Driver) GetURL() (string, error) { return "", notSupported }
|
||||
func (d *Driver) GetState() (state.State, error) { return state.None, notSupported }
|
||||
func (d *Driver) Kill() error { return notSupported }
|
||||
func (d *Driver) PreCreateCheck() error { return notSupported }
|
||||
func (d *Driver) Remove() error { return notSupported }
|
||||
func (d *Driver) Restart() error { return notSupported }
|
||||
func (d *Driver) SetConfigFromFlags(opts drivers.DriverOptions) error { return notSupported }
|
||||
func (d *Driver) Start() error { return notSupported }
|
||||
func (d *Driver) Stop() error { return notSupported }
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
//go:build linux
|
||||
//go:build linux && amd64
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package kvm
|
||||
|
||||
// The current version of the docker-machine-driver-kvm2
|
||||
|
||||
// version is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/drivers/kvm.version=vX.Y.Z"
|
||||
var version = "v0.0.0-unset"
|
||||
|
||||
// gitCommitID is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/drivers/kvm.gitCommitID=<commit-id>"
|
||||
var gitCommitID = ""
|
||||
|
||||
// GetVersion returns the current docker-machine-driver-kvm2 version
|
||||
func GetVersion() string {
|
||||
return version
|
||||
}
|
||||
|
||||
// GetGitCommitID returns the git commit id from which it is being built
|
||||
func GetGitCommitID() string {
|
||||
return gitCommitID
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ var ErrAuxDriverVersionNotinPath error
|
|||
|
||||
// InstallOrUpdate downloads driver if it is not present, or updates it if there's a newer version
|
||||
func InstallOrUpdate(name string, directory string, v semver.Version, interactive bool, autoUpdate bool) error {
|
||||
if name != driver.KVM2 && name != driver.HyperKit {
|
||||
if name != driver.HyperKit {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,6 @@ func minAcceptableDriverVersion(driverName string, mkVer semver.Version) semver.
|
|||
return *minHyperkitVersion
|
||||
}
|
||||
return mkVer
|
||||
case driver.KVM2:
|
||||
return mkVer
|
||||
default:
|
||||
klog.Warningf("Unexpected driver: %v", driverName)
|
||||
return mkVer
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ func Test_minDriverVersion(t *testing.T) {
|
|||
}{
|
||||
{"Hyperkit", driver.HyperKit, "1.1.1", *minHyperkitVersion},
|
||||
{"Invalid", "_invalid_", "1.1.1", v("1.1.1")},
|
||||
{"KVM2", driver.KVM2, "1.1.1", v("1.1.1")},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.desc, func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -318,9 +318,9 @@ var (
|
|||
DrvNotFound = Kind{ID: "DRV_NOT_FOUND", ExitCode: ExDriverNotFound}
|
||||
// minikube could not find a valid driver
|
||||
DrvNotDetected = Kind{ID: "DRV_NOT_DETECTED", ExitCode: ExDriverNotFound}
|
||||
// aux drivers (kvm or hyperkit) were not found
|
||||
// aux drivers (hyperkit) were not found
|
||||
DrvAuxNotNotFound = Kind{ID: "DRV_AUX_NOT_FOUND", ExitCode: ExDriverNotFound}
|
||||
// aux drivers (kvm or hyperkit) were found but not healthy
|
||||
// aux drivers (hyperkit) were found but not healthy
|
||||
DrvAuxNotHealthy = Kind{ID: "DRV_AUX_NOT_HEALTHY", ExitCode: ExDriverError}
|
||||
// minikube found drivers but none were ready to use
|
||||
DrvNotHealthy = Kind{ID: "DRV_NOT_HEALTHY", ExitCode: ExDriverNotFound}
|
||||
|
|
|
|||
|
|
@ -26,11 +26,13 @@ import (
|
|||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
|
||||
"k8s.io/minikube/pkg/drivers/kvm"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/download"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
|
|
@ -42,10 +44,15 @@ const (
|
|||
docURL = "https://minikube.sigs.k8s.io/docs/reference/drivers/kvm2/"
|
||||
)
|
||||
|
||||
// The driver is implemented for amd64 and arm64, but we cannot build the arm64
|
||||
// version yet: https://github.com/kubernetes/minikube/issues/19959.
|
||||
var supportedArchictures = []string{"amd64"}
|
||||
|
||||
func init() {
|
||||
if err := registry.Register(registry.DriverDef{
|
||||
Name: driver.KVM2,
|
||||
Alias: []string{driver.AliasKVM},
|
||||
Init: func() drivers.Driver { return kvm.NewDriver("", "") },
|
||||
Config: configure,
|
||||
Status: status,
|
||||
Default: true,
|
||||
|
|
@ -55,28 +62,9 @@ func init() {
|
|||
}
|
||||
}
|
||||
|
||||
// This is duplicate of kvm.Driver. Avoids importing the kvm2 driver, which requires cgo & libvirt.
|
||||
type kvmDriver struct {
|
||||
*drivers.BaseDriver
|
||||
|
||||
Memory int
|
||||
DiskSize int
|
||||
CPU int
|
||||
Network string
|
||||
PrivateNetwork string
|
||||
ISO string
|
||||
Boot2DockerURL string
|
||||
DiskPath string
|
||||
GPU bool
|
||||
Hidden bool
|
||||
ConnectionURI string
|
||||
NUMANodeCount int
|
||||
ExtraDisks int
|
||||
}
|
||||
|
||||
func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
|
||||
name := config.MachineName(cc, n)
|
||||
return kvmDriver{
|
||||
return kvm.Driver{
|
||||
BaseDriver: &drivers.BaseDriver{
|
||||
MachineName: name,
|
||||
StorePath: localpath.MiniPath(),
|
||||
|
|
@ -116,6 +104,18 @@ func defaultURI() string {
|
|||
}
|
||||
|
||||
func status() registry.State {
|
||||
if !slices.Contains(supportedArchictures, runtime.GOARCH) {
|
||||
rs := registry.State{
|
||||
Error: fmt.Errorf("KVM is not supported on %q, contributions are welcome", runtime.GOARCH),
|
||||
Fix: fmt.Sprintf("you can use the KVM driver on %s", strings.Join(supportedArchictures, ",")),
|
||||
}
|
||||
// The driver is implemented but we cannot build it yet.
|
||||
if runtime.GOARCH == "arm64" {
|
||||
rs.Doc = "https://github.com/kubernetes/minikube/issues/19959"
|
||||
}
|
||||
return rs
|
||||
}
|
||||
|
||||
// Allow no more than 6 seconds for querying state
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 6*time.Second)
|
||||
defer cancel()
|
||||
|
|
@ -167,17 +167,6 @@ func status() registry.State {
|
|||
}
|
||||
}
|
||||
|
||||
if runtime.GOARCH == "arm64" {
|
||||
return registry.State{
|
||||
Installed: true,
|
||||
Running: true,
|
||||
Error: fmt.Errorf("KVM is not supported on arm64 due to a gcc build error, contributions are welcome"),
|
||||
Fix: "follow the github issue for possible fix",
|
||||
Doc: "https://github.com/kubernetes/minikube/issues/19959",
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return registry.State{
|
||||
Installed: true,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ If you are running KVM in a nested virtualization environment ensure your config
|
|||
* Run `virt-host-validate` and check for the suggestions.
|
||||
* Run ``ls -la `which virsh` ``, `virsh uri`, `sudo virsh net-list --all` and `ip a s` to collect additional information for debugging.
|
||||
* Run `minikube start --alsologtostderr -v=9` to debug crashes.
|
||||
* Run `docker-machine-driver-kvm2 version` to verify the kvm2 driver executes properly.
|
||||
* Read [How to debug Virtualization problems](https://fedoraproject.org/wiki/How_to_debug_Virtualization_problems)
|
||||
|
||||
### Troubleshooting KVM/libvirt networks
|
||||
|
|
|
|||
|
|
@ -86,10 +86,6 @@ to expose GPUs with `--driver=kvm`. Please don't mix these instructions.
|
|||
When using NVIDIA GPUs with the kvm driver, we passthrough spare GPUs on the
|
||||
host to the minikube VM. Doing so has a few prerequisites:
|
||||
|
||||
- You must install the [kvm driver]({{< ref "/docs/drivers/kvm2" >}}) If you already had
|
||||
this installed make sure that you fetch the latest
|
||||
`docker-machine-driver-kvm` binary that has GPU support.
|
||||
|
||||
- Your CPU must support IOMMU. Different vendors have different names for this
|
||||
technology. Intel calls it Intel VT-d. AMD calls it AMD-Vi. Your motherboard
|
||||
must also support IOMMU.
|
||||
|
|
|
|||
|
|
@ -31,83 +31,6 @@ import (
|
|||
"k8s.io/minikube/pkg/version"
|
||||
)
|
||||
|
||||
// TestKVMDriverInstallOrUpdate makes sure our docker-machine-driver-kvm2 binary can be installed properly
|
||||
func TestKVMDriverInstallOrUpdate(t *testing.T) {
|
||||
if NoneDriver() {
|
||||
t.Skip("Skip none driver.")
|
||||
}
|
||||
|
||||
if runtime.GOOS != "linux" {
|
||||
t.Skip("Skip if not linux.")
|
||||
}
|
||||
|
||||
if arm64Platform() {
|
||||
t.Skip("Skip if arm64. See https://github.com/kubernetes/minikube/issues/10144")
|
||||
}
|
||||
|
||||
MaybeParallel(t)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
path string
|
||||
}{
|
||||
{name: "driver-with-older-version", path: filepath.Join(*testdataDir, "kvm2-driver-older-version")},
|
||||
}
|
||||
|
||||
originalPath := os.Getenv("PATH")
|
||||
defer os.Setenv("PATH", originalPath)
|
||||
|
||||
for _, tc := range tests {
|
||||
tempDLDir := t.TempDir()
|
||||
|
||||
pwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatalf("Error not expected when getting working directory. test: %s, got: %v", tc.name, err)
|
||||
}
|
||||
|
||||
path := filepath.Join(pwd, tc.path)
|
||||
|
||||
_, err = os.Stat(filepath.Join(path, "docker-machine-driver-kvm2"))
|
||||
if err != nil {
|
||||
t.Fatalf("Expected test data driver to exist. test: %s, got: %v", tc.name, err)
|
||||
}
|
||||
|
||||
// copy test data driver into the temp download dir so we can point PATH to it for before/after install
|
||||
src := filepath.Join(path, "docker-machine-driver-kvm2")
|
||||
dst := filepath.Join(tempDLDir, "docker-machine-driver-kvm2")
|
||||
if err = CopyFile(src, dst, false); err != nil {
|
||||
t.Fatalf("Failed to copy test data driver to temp dir. test: %s, got: %v", tc.name, err)
|
||||
}
|
||||
|
||||
// point to the copied driver for the rest of the test
|
||||
path = tempDLDir
|
||||
|
||||
// change permission to allow driver to be executable
|
||||
err = os.Chmod(filepath.Join(path, "docker-machine-driver-kvm2"), 0700)
|
||||
if err != nil {
|
||||
t.Fatalf("Expected not expected when changing driver permission. test: %s, got: %v", tc.name, err)
|
||||
}
|
||||
|
||||
os.Setenv("PATH", fmt.Sprintf("%s:%s", path, originalPath))
|
||||
|
||||
// NOTE: This should be a real version, as it impacts the downloaded URL
|
||||
newerVersion, err := semver.Make("1.37.0")
|
||||
if err != nil {
|
||||
t.Fatalf("Expected new semver. test: %v, got: %v", tc.name, err)
|
||||
}
|
||||
|
||||
err = auxdriver.InstallOrUpdate("kvm2", tempDLDir, newerVersion, true, true)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to update driver to %v. test: %s, got: %v", newerVersion, tc.name, err)
|
||||
}
|
||||
|
||||
_, err = os.Stat(filepath.Join(tempDLDir, "docker-machine-driver-kvm2"))
|
||||
if err != nil {
|
||||
t.Fatalf("Expected driver to be download. test: %s, got: %v", tc.name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestHyperKitDriverInstallOrUpdate makes sure our docker-machine-driver-hyperkit binary can be installed properly
|
||||
func TestHyperKitDriverInstallOrUpdate(t *testing.T) {
|
||||
if runtime.GOOS != "darwin" {
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ func HyperkitDriver() bool {
|
|||
|
||||
// NeedsAuxDriver Returns true if the driver needs an auxiliary driver (kvm, hyperkit,..)
|
||||
func NeedsAuxDriver() bool {
|
||||
return HyperkitDriver() || KVMDriver()
|
||||
return HyperkitDriver()
|
||||
}
|
||||
|
||||
// VMDriver checks if the driver is a VM
|
||||
|
|
|
|||
Loading…
Reference in New Issue