Merge pull request #17866 from spowelljr/fixAutoPause

addons: Fix auto-pause addon
pull/17903/head
Steven Powell 2024-01-10 11:29:38 -08:00 committed by GitHub
commit 042336d576
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 11 additions and 66 deletions

View File

@ -24,7 +24,7 @@ KIC_VERSION ?= $(shell egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f
HUGO_VERSION ?= $(shell egrep "HUGO_VERSION = \"" netlify.toml | cut -d \" -f2)
# Default to .0 for higher cache hit rates, as build increments typically don't require new ISO versions
ISO_VERSION ?= v1.32.1-1702708929-17806
ISO_VERSION ?= v1.32.1-1703784139-17866
# Dashes are valid in semver, but not Linux packaging. Use ~ to delimit alpha/beta
DEB_VERSION ?= $(subst -,~,$(RAW_VERSION))

View File

@ -24,13 +24,10 @@ import (
"sync"
"time"
"github.com/spf13/viper"
"k8s.io/minikube/pkg/minikube/cluster"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/cruntime"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/style"
@ -48,11 +45,8 @@ var runtime = flag.String("container-runtime", "docker", "Container runtime to u
func main() {
flag.Parse()
profile := viper.GetString(config.ProfileName)
_, cfg := mustload.Partial(profile)
interval := cfg.AutoPauseInterval
tickerChannel := time.NewTicker(interval)
// TODO: #10595 make this configurable
const interval = time.Minute * 1
// Check current state
alreadyPaused()
@ -60,25 +54,15 @@ func main() {
// channel for incoming messages
go func() {
for {
// On each iteration new timer is created
select {
case <-tickerChannel.C:
// TODO: #10596 make it memory-leak proof
case <-time.After(interval):
runPause()
case <-unpauseRequests:
fmt.Printf("Got request\n")
if runtimePaused {
runUnpause()
// Reset once cluster has been unpaused.
tickerChannel.Reset(interval)
// Avoid race where tick happens before Reset call and after unPause.
for {
select {
case <-tickerChannel.C:
default:
break
}
}
}
done <- struct{}{}

View File

@ -20,8 +20,6 @@ import (
"net"
"os"
"regexp"
"strconv"
"time"
"github.com/spf13/cobra"
"k8s.io/minikube/pkg/addons"
@ -257,25 +255,6 @@ var addonsConfigureCmd = &cobra.Command{
out.ErrT(style.Fatal, "Failed to configure registry-aliases {{.profile}}", out.V{"profile": profile})
}
}
case "auto-pause-interval":
profile := ClusterFlagValue()
_, cfg := mustload.Partial(profile)
intervalInput := AskForStaticValue("-- Enter interval time of auto-pause-interval (in minutes): ")
intervalTime, err := strconv.Atoi(intervalInput)
if err != nil {
out.ErrT(style.Fatal, "Failed to extract integer in minutes to pause.")
}
if intervalTime <= 0 {
out.ErrT(style.Fatal, "Auto-pause interval must be greater than 0,"+
" not current value of {{.interval}}", out.V{"interval": intervalTime})
}
cfg.AutoPauseInterval = time.Minute * time.Duration(intervalTime)
if err := config.SaveProfile(profile, cfg); err != nil {
out.ErrT(style.Fatal, "Failed to save config {{.profile}}", out.V{"profile": profile})
}
default:
out.FailureT("{{.name}} has no available configuration options", out.V{"name": addon})

View File

@ -141,7 +141,6 @@ const (
socketVMnetClientPath = "socket-vmnet-client-path"
socketVMnetPath = "socket-vmnet-path"
staticIP = "static-ip"
autoPauseInterval = "auto-pause-interval"
gpus = "gpus"
)
@ -204,7 +203,6 @@ func initMinikubeFlags() {
startCmd.Flags().Bool(disableOptimizations, false, "If set, disables optimizations that are set for local Kubernetes. Including decreasing CoreDNS replicas from 2 to 1. Defaults to false.")
startCmd.Flags().Bool(disableMetrics, false, "If set, disables metrics reporting (CPU and memory usage), this can improve CPU usage. Defaults to false.")
startCmd.Flags().String(staticIP, "", "Set a static IP for the minikube cluster, the IP must be: private, IPv4, and the last octet must be between 2 and 254, for example 192.168.200.200 (Docker and Podman drivers only)")
startCmd.Flags().Duration(autoPauseInterval, time.Minute*1, "Duration of inactivity before the minikube VM is paused (default 1m0s). To disable, set to 0s")
startCmd.Flags().StringP(gpus, "g", "", "Allow pods to use your NVIDIA GPUs. Options include: [all,nvidia] (Docker driver with Docker container-runtime only)")
}
@ -604,7 +602,6 @@ func generateNewConfigFromFlags(cmd *cobra.Command, k8sVersion string, rtime str
NodePort: viper.GetInt(apiServerPort),
},
MultiNodeRequested: viper.GetInt(nodes) > 1,
AutoPauseInterval: viper.GetDuration(autoPauseInterval),
GPUs: viper.GetString(gpus),
}
cc.VerifyComponents = interpretWaitFlag(*cmd)
@ -820,7 +817,6 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
updateStringFromFlag(cmd, &cc.CustomQemuFirmwarePath, qemuFirmwarePath)
updateStringFromFlag(cmd, &cc.SocketVMnetClientPath, socketVMnetClientPath)
updateStringFromFlag(cmd, &cc.SocketVMnetPath, socketVMnetPath)
updateDurationFromFlag(cmd, &cc.AutoPauseInterval, autoPauseInterval)
if cmd.Flags().Changed(kubernetesVersion) {
kubeVer, err := getKubernetesVersion(existing)

View File

@ -24,10 +24,10 @@ import (
const (
// Version is the current version of kic
Version = "v0.0.42-1704751654-17830"
Version = "v0.0.42-1704759386-17866"
// SHA of the kic base image
baseImageSHA = "cabd32f8d9e8d804966eb117ed5366660f6363a4d1415f0b5480de6e396be617"
baseImageSHA = "8c3c33047f9bc285e1f5f2a5aa14744a2fe04c58478f02f77b06169dea8dd3f0"
// The name of the GCR kicbase repository
gcrRepo = "gcr.io/k8s-minikube/kicbase-builds"
// The name of the Dockerhub kicbase repository

View File

@ -135,7 +135,7 @@ var Addons = map[string]*Addon{
// GuestPersistentDir
}, false, "auto-pause", "minikube", "", "", map[string]string{
"AutoPauseHook": "k8s-minikube/auto-pause-hook:v0.0.4@sha256:c1792e370216fcdfd8c4540a87e3fa867da204dd5521623796e2d28498a894ff",
"AutoPauseHook": "k8s-minikube/auto-pause-hook:v0.0.5@sha256:d613ed2c891882b602b5aca668e92d4606a1b3832d96750ab25804de15929522",
}, map[string]string{
"AutoPauseHook": "gcr.io",
}),

View File

@ -107,7 +107,6 @@ type ClusterConfig struct {
StaticIP string
SSHAuthSock string
SSHAgentPID int
AutoPauseInterval time.Duration // Specifies interval of time to wait before checking if cluster should be paused
GPUs string
}

View File

@ -41,7 +41,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-builds/iso/17806"
isoBucket := "minikube-builds/iso/17866"
return []string{
fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s-%s.iso", isoBucket, v, runtime.GOARCH),

View File

@ -25,9 +25,8 @@ minikube start [flags]
--apiserver-name string The authoritative apiserver hostname for apiserver certificates and connectivity. This can be used if you want to make the apiserver available from outside the machine (default "minikubeCA")
--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-pause-interval duration Duration of inactivity before the minikube VM is paused (default 1m0s). To disable, set to 0s (default 1m0s)
--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-builds:v0.0.42-1704751654-17830@sha256:cabd32f8d9e8d804966eb117ed5366660f6363a4d1415f0b5480de6e396be617")
--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.42-1704759386-17866@sha256:8c3c33047f9bc285e1f5f2a5aa14744a2fe04c58478f02f77b06169dea8dd3f0")
--binary-mirror string Location to fetch kubectl, kubelet, & kubeadm binaries from.
--cache-images If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --driver=none. (default true)
--cert-expiration duration Duration until minikube certificate expiration, defaults to three years (26280h). (default 26280h0m0s)

View File

@ -191,7 +191,6 @@
"Due to issues with CRI-O post v1.17.3, we need to restart your cluster.": "Debido a problemas con CRI-O post v1.17.3, necesitamos reiniciar tu cluster.",
"Due to networking limitations of driver {{.driver_name}} on {{.os_name}}, {{.addon_name}} addon is not supported.\nAlternatively to use this addon you can use a vm-based driver:\n\n\t'minikube start --vm=true'\n\nTo track the update on this work in progress feature please check:\nhttps://github.com/kubernetes/minikube/issues/7332": "Debido a las limitaciones de red del controlador {{.driver_name}} en {{.os_name}}, el complemento \"{{.addon_name}}\" no está soportado.\nPara usar este complemento, puedes utilizar un controlador basado en vm\n\n\t'minikube start --vm=true'\n\nPara realizar un seguimiento de las actualizaciones de esta función consulte:\nhttps://github.com/kubernetes/minikube/issues/7332",
"Due to networking limitations of driver {{.driver_name}}, {{.addon_name}} addon is not supported. Try using a different driver.": "Debido a limitaciones de red del controlador {{.driver_name}}, el complemento \"{{.addon_name}}\" no está soportado. Intenta usar un controlador diferente.",
"Duration of inactivity before the minikube VM is paused (default 1m0s). To disable, set to 0s": "",
"Duration until minikube certificate expiration, defaults to three years (26280h).": "",
"ERROR creating `registry-creds-acr` secret": "ERROR creando el secreto `registry-creds-acr`",
"ERROR creating `registry-creds-dpr` secret": "ERROR creando el secreto `registry-creds-dpr`",
@ -280,7 +279,6 @@
"Failed to delete images from config": "",
"Failed to download licenses": "",
"Failed to enable container runtime": "",
"Failed to extract integer in minutes to pause.": "",
"Failed to get bootstrapper": "",
"Failed to get command runner": "",
"Failed to get image map": "",

View File

@ -175,7 +175,6 @@
"Downloading driver {{.driver}}:": "{{.driver}} ドライバーをダウンロードしています:",
"Due to DNS issues your cluster may have problems starting and you may not be able to pull images\nMore details available at: https://minikube.sigs.k8s.io/docs/drivers/qemu/#known-issues": "DNS の問題により、クラスターの起動に問題が発生し、イメージを取得できない場合があります\n詳細については、https://minikube.sigs.k8s.io/docs/drivers/qemu/#known-issues を参照してください",
"Due to changes in macOS 13+ minikube doesn't currently support VirtualBox. You can use alternative drivers such as docker or {{.driver}}.\n https://minikube.sigs.k8s.io/docs/drivers/docker/\n https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}/\n\n For more details on the issue see: https://github.com/kubernetes/minikube/issues/15274\n": "",
"Duration of inactivity before the minikube VM is paused (default 1m0s). To disable, set to 0s": "",
"Duration until minikube certificate expiration, defaults to three years (26280h).": "minikube 証明書の有効期限。デフォルトは 3 年間 (26280h)。",
"ERROR creating `registry-creds-acr` secret": "`registry-creds-acr` シークレット作成中にエラーが発生しました",
"ERROR creating `registry-creds-dpr` secret": "`registry-creds-dpr` シークレット作成中にエラーが発生しました",
@ -259,7 +258,6 @@
"Failed to delete images from config": "設定ファイル中のイメージの削除に失敗しました",
"Failed to download licenses": "ライセンスのダウンロードに失敗しました",
"Failed to enable container runtime": "コンテナーランタイムの有効化に失敗しました",
"Failed to extract integer in minutes to pause.": "",
"Failed to get bootstrapper": "ブートストラッパーの取得に失敗しました",
"Failed to get command runner": "コマンドランナーの取得に失敗しました",
"Failed to get image map": "イメージマップの取得に失敗しました",

View File

@ -191,7 +191,6 @@
"Downloading {{.name}} {{.version}}": "{{.name}} {{.version}} 다운로드 중",
"Due to DNS issues your cluster may have problems starting and you may not be able to pull images\nMore details available at: https://minikube.sigs.k8s.io/docs/drivers/qemu/#known-issues": "",
"Due to changes in macOS 13+ minikube doesn't currently support VirtualBox. You can use alternative drivers such as docker or {{.driver}}.\n https://minikube.sigs.k8s.io/docs/drivers/docker/\n https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}/\n\n For more details on the issue see: https://github.com/kubernetes/minikube/issues/15274\n": "",
"Duration of inactivity before the minikube VM is paused (default 1m0s). To disable, set to 0s": "",
"Duration until minikube certificate expiration, defaults to three years (26280h).": "",
"ERROR creating `registry-creds-acr` secret": "registry-creds-acr` secret 생성 오류",
"ERROR creating `registry-creds-dpr` secret": "`registry-creds-dpr` secret 생성 오류",
@ -289,7 +288,6 @@
"Failed to delete node {{.name}}": "노드 {{.name}} 제거에 실패하였습니다",
"Failed to download licenses": "",
"Failed to enable container runtime": "컨테이너 런타임 활성화에 실패하였습니다",
"Failed to extract integer in minutes to pause.": "",
"Failed to generate config": "컨피그 생성에 실패하였습니다",
"Failed to get bootstrapper": "부트스트래퍼 조회에 실패하였습니다",
"Failed to get command runner": "",

View File

@ -191,7 +191,6 @@
"Downloading {{.name}} {{.version}}": "Pobieranie {{.name}} {{.version}}",
"Due to DNS issues your cluster may have problems starting and you may not be able to pull images\nMore details available at: https://minikube.sigs.k8s.io/docs/drivers/qemu/#known-issues": "",
"Due to changes in macOS 13+ minikube doesn't currently support VirtualBox. You can use alternative drivers such as docker or {{.driver}}.\n https://minikube.sigs.k8s.io/docs/drivers/docker/\n https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}/\n\n For more details on the issue see: https://github.com/kubernetes/minikube/issues/15274\n": "",
"Duration of inactivity before the minikube VM is paused (default 1m0s). To disable, set to 0s": "",
"Duration until minikube certificate expiration, defaults to three years (26280h).": "",
"ERROR creating `registry-creds-acr` secret": "",
"ERROR creating `registry-creds-dpr` secret": "",
@ -278,7 +277,6 @@
"Failed to download kubectl": "Pobieranie kubectl nie powiodło się",
"Failed to download licenses": "",
"Failed to enable container runtime": "",
"Failed to extract integer in minutes to pause.": "",
"Failed to get bootstrapper": "",
"Failed to get command runner": "",
"Failed to get image map": "",

View File

@ -170,7 +170,6 @@
"Downloading driver {{.driver}}:": "",
"Due to DNS issues your cluster may have problems starting and you may not be able to pull images\nMore details available at: https://minikube.sigs.k8s.io/docs/drivers/qemu/#known-issues": "",
"Due to changes in macOS 13+ minikube doesn't currently support VirtualBox. You can use alternative drivers such as docker or {{.driver}}.\n https://minikube.sigs.k8s.io/docs/drivers/docker/\n https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}/\n\n For more details on the issue see: https://github.com/kubernetes/minikube/issues/15274\n": "",
"Duration of inactivity before the minikube VM is paused (default 1m0s). To disable, set to 0s": "",
"Duration until minikube certificate expiration, defaults to three years (26280h).": "",
"ERROR creating `registry-creds-acr` secret": "",
"ERROR creating `registry-creds-dpr` secret": "",
@ -251,7 +250,6 @@
"Failed to delete images from config": "",
"Failed to download licenses": "",
"Failed to enable container runtime": "",
"Failed to extract integer in minutes to pause.": "",
"Failed to get bootstrapper": "",
"Failed to get command runner": "",
"Failed to get image map": "",

View File

@ -170,7 +170,6 @@
"Downloading driver {{.driver}}:": "",
"Due to DNS issues your cluster may have problems starting and you may not be able to pull images\nMore details available at: https://minikube.sigs.k8s.io/docs/drivers/qemu/#known-issues": "",
"Due to changes in macOS 13+ minikube doesn't currently support VirtualBox. You can use alternative drivers such as docker or {{.driver}}.\n https://minikube.sigs.k8s.io/docs/drivers/docker/\n https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}/\n\n For more details on the issue see: https://github.com/kubernetes/minikube/issues/15274\n": "",
"Duration of inactivity before the minikube VM is paused (default 1m0s). To disable, set to 0s": "",
"Duration until minikube certificate expiration, defaults to three years (26280h).": "",
"ERROR creating `registry-creds-acr` secret": "",
"ERROR creating `registry-creds-dpr` secret": "",
@ -251,7 +250,6 @@
"Failed to delete images from config": "",
"Failed to download licenses": "",
"Failed to enable container runtime": "",
"Failed to extract integer in minutes to pause.": "",
"Failed to get bootstrapper": "",
"Failed to get command runner": "",
"Failed to get image map": "",