Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto-pause to VMs #11019

Merged
merged 7 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from 6 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ _testmain.go
*.test
*.prof

/deploy/iso/minikube-iso/board/coreos/minikube/rootfs-overlay/usr/bin/auto-pause
/deploy/kicbase/auto-pause
/deploy/addons/auto-pause/auto-pause-hook
/out
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ KUBERNETES_VERSION ?= $(shell egrep "DefaultKubernetesVersion =" pkg/minikube/co
KIC_VERSION ?= $(shell egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f2)

# Default to .0 for higher cache hit rates, as build increments typically don't require new ISO versions
ISO_VERSION ?= v1.19.0
ISO_VERSION ?= v1.19.0-1617859429-11019
# Dashes are valid in semver, but not Linux packaging. Use ~ to delimit alpha/beta
DEB_VERSION ?= $(subst -,~,$(RAW_VERSION))
DEB_REVISION ?= 0
Expand Down Expand Up @@ -261,7 +261,7 @@ out/e2e-%: out/minikube-%
out/e2e-windows-amd64.exe: out/e2e-windows-amd64
cp $< $@

minikube_iso: # old target kept for making tests happy
minikube_iso: deploy/iso/minikube-iso/board/coreos/minikube/rootfs-overlay/usr/bin/auto-pause # build minikube iso
echo $(ISO_VERSION) > deploy/iso/minikube-iso/board/coreos/minikube/rootfs-overlay/etc/VERSION
if [ ! -d $(BUILD_DIR)/buildroot ]; then \
mkdir -p $(BUILD_DIR); \
Expand Down Expand Up @@ -834,6 +834,11 @@ out/mkcmp:
deploy/kicbase/auto-pause: $(SOURCE_GENERATED) $(SOURCE_FILES)
GOOS=linux GOARCH=$(GOARCH) go build -o $@ cmd/auto-pause/auto-pause.go

# auto pause binary to be used for ISO
deploy/iso/minikube-iso/board/coreos/minikube/rootfs-overlay/usr/bin/auto-pause: $(SOURCE_GENERATED) $(SOURCE_FILES)
GOOS=linux GOARCH=$(GOARCH) go build -o $@ cmd/auto-pause/auto-pause.go


.PHONY: deploy/addons/auto-pause/auto-pause-hook
deploy/addons/auto-pause/auto-pause-hook: $(SOURCE_GENERATED) ## Build auto-pause hook addon
$(if $(quiet),@echo " GO $@")
Expand Down
2 changes: 1 addition & 1 deletion deploy/addons/auto-pause/auto-pause.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=Auto Pause Service

[Service]
Type=simple
ExecStart=/usr/local/bin/auto-pause
ExecStart=/bin/auto-pause
Restart=always

[Install]
Expand Down
4 changes: 2 additions & 2 deletions deploy/kicbase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ COPY 10-network-security.conf /etc/sysctl.d/10-network-security.conf
COPY 11-tcp-mtu-probing.conf /etc/sysctl.d/11-tcp-mtu-probing.conf
COPY clean-install /usr/local/bin/clean-install
COPY entrypoint /usr/local/bin/entrypoint
# must first run make out/auto-pause
COPY auto-pause /usr/local/bin/auto-pause
# must first run `make deploy/kicbase/auto-pause`
COPY auto-pause /bin/auto-pause

# Install dependencies, first from apt, then from release tarballs.
# NOTE: we use one RUN to minimize layers.
Expand Down
2 changes: 1 addition & 1 deletion hack/jenkins/kicbase_auto_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -x -o pipefail
set -x

# Make sure docker is installed and configured
./hack/jenkins/installers/check_install_docker.sh
Expand Down
4 changes: 2 additions & 2 deletions pkg/addons/addons_autopause.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func enableOrDisableAutoPause(cc *config.ClusterConfig, name string, val string)
out.Infof("auto-pause addon is an alpha feature and still in early development. Please file issues to help us make it better.")
out.Infof("https://github.com/kubernetes/minikube/labels/co%2Fauto-pause")

if !driver.IsKIC(cc.Driver) || runtime.GOARCH != "amd64" {
exit.Message(reason.Usage, `auto-pause currently is only supported on docker driver/docker runtime/amd64. Track progress of others here: https://github.com/kubernetes/minikube/issues/10601`)
if cc.KubernetesConfig.ContainerRuntime != "docker" || runtime.GOARCH != "amd64" {
exit.Message(reason.Usage, `auto-pause currently is only supported on docker runtime and amd64. Track progress of others here: https://github.com/kubernetes/minikube/issues/10601`)
}
co := mustload.Running(cc.Name)
if enable {
Expand Down
8 changes: 4 additions & 4 deletions pkg/drivers/kic/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (

const (
// Version is the current version of kic
Version = "v0.0.19"
Version = "v0.0.19-1617905290-11019"
// SHA of the kic base image
baseImageSHA = "4d7ca4cd5eda77ade1a15fb898d22ed0111d76106858d1cae25be9b110ec4b4a"
baseImageSHA = "f52f5c903f19f6ad4767954309d3127280dbf0b9255b840fe665c34d5bb3c1c6"
// The name of the GCR kicbase repository
gcrRepo = "gcr.io/k8s-minikube/kicbase"
gcrRepo = "gcr.io/k8s-minikube/kicbase-builds"
// The name of the Dockerhub kicbase repository
dockerhubRepo = "kicbase/stable"
dockerhubRepo = "kicbase/build"
Copy link
Contributor

@ilya-zuyev ilya-zuyev Apr 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to merge this change? Are we going to use 'build' repo in release version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after PR is merged we will need to release stable kic
in a separaete PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Just curious, this PR is about VM/ISO, why do we have changes related to kicbase here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we moved where the auto-pause binary lives, so there needed to be a corresponding change in kicbase's Dockerfile. any kicbase change needs a rebuild.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the VM only we could add binaries into this path, and needed to change the systemd to direct to this

)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/download/iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const fileScheme = "file"
// DefaultISOURLs returns a list of ISO URL's to consult by default, in priority order
func DefaultISOURLs() []string {
v := version.GetISOVersion()
isoBucket := "minikube/iso"
isoBucket := "minikube-builds/iso/11019"
return []string{
fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s.iso", isoBucket, v),
fmt.Sprintf("https://github.com/kubernetes/minikube/releases/download/%s/minikube-%s.iso", v, v),
Expand Down
4 changes: 2 additions & 2 deletions site/content/en/docs/commands/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ minikube start [flags]
--apiserver-names strings A set of apiserver names which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine
--apiserver-port int The apiserver listening port (default 8443)
--auto-update-drivers If set, automatically updates drivers to the latest version. Defaults to true. (default true)
--base-image string The base image to use for docker/podman drivers. Intended for local development. (default "gcr.io/k8s-minikube/kicbase:v0.0.19@sha256:4d7ca4cd5eda77ade1a15fb898d22ed0111d76106858d1cae25be9b110ec4b4a")
--base-image string The base image to use for docker/podman drivers. Intended for local development. (default "gcr.io/k8s-minikube/kicbase-builds:v0.0.19-1617905290-11019@sha256:f52f5c903f19f6ad4767954309d3127280dbf0b9255b840fe665c34d5bb3c1c6")
--cache-images If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --driver=none. (default true)
--cni string CNI plug-in to use. Valid options: auto, bridge, calico, cilium, flannel, kindnet, or path to a CNI manifest (default: auto)
--container-runtime string The container runtime to be used (docker, cri-o, containerd). (default "docker")
Expand Down Expand Up @@ -64,7 +64,7 @@ minikube start [flags]
--insecure-registry strings Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.
--install-addons If set, install addons. Defaults to true. (default true)
--interactive Allow user prompts for more information (default true)
--iso-url strings Locations to fetch the minikube ISO from. (default [https://storage.googleapis.com/minikube/iso/minikube-v1.19.0.iso,https://github.com/kubernetes/minikube/releases/download/v1.19.0/minikube-v1.19.0.iso,https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/iso/minikube-v1.19.0.iso])
--iso-url strings Locations to fetch the minikube ISO from. (default [https://storage.googleapis.com/minikube-builds/iso/11019/minikube-v1.19.0-1617859429-11019.iso,https://github.com/kubernetes/minikube/releases/download/v1.19.0-1617859429-11019/minikube-v1.19.0-1617859429-11019.iso,https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/iso/minikube-v1.19.0-1617859429-11019.iso])
--keep-context This will keep the existing kubectl context and will create a minikube context.
--kubernetes-version string The Kubernetes version that the minikube VM will use (ex: v1.2.3, 'stable' for v1.20.5, 'latest' for v1.21.0-rc.0). Defaults to 'stable'.
--kvm-gpu Enable experimental NVIDIA GPU support in minikube
Expand Down