From a54ea82e3b9b2f44b9444116d8c32bdd4b50914a Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 20 Oct 2020 13:45:59 -0700 Subject: [PATCH 01/18] Implement schedule stop for unix --- cmd/minikube/cmd/stop.go | 19 +++- go.mod | 2 + go.sum | 2 + pkg/minikube/config/types.go | 7 ++ pkg/minikube/localpath/localpath.go | 6 ++ pkg/minikube/reason/reason.go | 1 + pkg/minikube/schedule/daemonize_unix.go | 79 ++++++++++++++ pkg/minikube/schedule/daemonize_windows.go | 32 ++++++ pkg/minikube/schedule/schedule.go | 47 +++++++++ test/integration/scheduled_stop_test.go | 114 +++++++++++++++++++++ 10 files changed, 307 insertions(+), 2 deletions(-) create mode 100644 pkg/minikube/schedule/daemonize_unix.go create mode 100644 pkg/minikube/schedule/daemonize_windows.go create mode 100644 pkg/minikube/schedule/schedule.go create mode 100644 test/integration/scheduled_stop_test.go diff --git a/cmd/minikube/cmd/stop.go b/cmd/minikube/cmd/stop.go index 1079749f3d..f715db0473 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -35,13 +35,15 @@ import ( "k8s.io/minikube/pkg/minikube/out" "k8s.io/minikube/pkg/minikube/out/register" "k8s.io/minikube/pkg/minikube/reason" + "k8s.io/minikube/pkg/minikube/schedule" "k8s.io/minikube/pkg/minikube/style" "k8s.io/minikube/pkg/util/retry" ) var ( - stopAll bool - keepActive bool + stopAll bool + keepActive bool + scheduledStop string ) // stopCmd represents the stop command @@ -55,6 +57,7 @@ var stopCmd = &cobra.Command{ func init() { stopCmd.Flags().BoolVar(&stopAll, "all", false, "Set flag to stop all profiles (clusters)") stopCmd.Flags().BoolVar(&keepActive, "keep-context-active", false, "keep the kube-context active after cluster is stopped. Defaults to false.") + stopCmd.Flags().StringVar(&scheduledStop, "schedule", "", "Set flag to stop cluster after a set amount of time (e.g. --schedule=5m)") if err := viper.GetViper().BindPFlags(stopCmd.Flags()); err != nil { exit.Error(reason.InternalFlagsBind, "unable to bind flags", err) @@ -81,6 +84,18 @@ func runStop(cmd *cobra.Command, args []string) { profilesToStop = append(profilesToStop, cname) } + if scheduledStop != "" { + duration, err := time.ParseDuration(scheduledStop) + if err != nil { + exit.Message(reason.Usage, "provided value {{.schedule}} to --schedule is not a valid Golang time.Duration", out.V{"schedule": scheduledStop}) + } + if err := schedule.Daemonize(profilesToStop, duration); err != nil { + exit.Message(reason.DaemonizeError, "unable to daemonize: {{.err}}", out.V{"err": err.Error()}) + } + klog.Infof("sleeping %s before completing stop...", duration.String()) + time.Sleep(duration) + } + stoppedNodes := 0 for _, profile := range profilesToStop { stoppedNodes = stopProfile(profile) diff --git a/go.mod b/go.mod index b9919572fe..271c87078d 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 // indirect github.com/Parallels/docker-machine-parallels v1.3.0 github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect + github.com/VividCortex/godaemon v0.0.0-20200629145737-581b70a8a603 github.com/blang/semver v3.5.0+incompatible github.com/c4milo/gotoolkit v0.0.0-20170318115440-bcc06269efa9 // indirect github.com/cenkalti/backoff v2.2.1+incompatible @@ -24,6 +25,7 @@ require ( github.com/evanphx/json-patch v4.5.0+incompatible // indirect github.com/go-ole/go-ole v1.2.4 // indirect github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 + github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/google/go-cmp v0.4.1 github.com/google/go-containerregistry v0.0.0-20200601195303-96cf69f03a3c github.com/google/go-github v17.0.0+incompatible diff --git a/go.sum b/go.sum index 610ae24e08..7ce3e995e0 100644 --- a/go.sum +++ b/go.sum @@ -117,6 +117,8 @@ github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUW github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM= github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA= +github.com/VividCortex/godaemon v0.0.0-20200629145737-581b70a8a603 h1:ZqOqBuBJ9QfCo2ErNFCVh5UXWtwXu01xb/WX1ND0rPM= +github.com/VividCortex/godaemon v0.0.0-20200629145737-581b70a8a603/go.mod h1:Y8CJ3IwPIAkMhv/rRUWIlczaeqd9ty9yrl+nc2AbaL4= github.com/afbjorklund/go-containerregistry v0.0.0-20200902152226-fbad78ec2813 h1:0tskN1ipU/BBrpoEIy0rdZS9jf5+wdP6IMRak8Iu/YE= github.com/afbjorklund/go-containerregistry v0.0.0-20200902152226-fbad78ec2813/go.mod h1:npTSyywOeILcgWqd+rvtzGWflIPPcBQhYoOONaY4ltM= github.com/afbjorklund/go-getter v1.4.1-0.20190910175809-eb9f6c26742c h1:18gEt7qzn7CW7qMkfPTFyyotlPbvPQo9o4IDV8jZqP4= diff --git a/pkg/minikube/config/types.go b/pkg/minikube/config/types.go index e56086b960..d09ce82e5f 100644 --- a/pkg/minikube/config/types.go +++ b/pkg/minikube/config/types.go @@ -71,6 +71,7 @@ type ClusterConfig struct { Addons map[string]bool VerifyComponents map[string]bool // map of components to verify and wait for after start. StartHostTimeout time.Duration + ScheduledStop *ScheduledStopConfig ExposedPorts []string // Only used by the docker and podman driver } @@ -137,3 +138,9 @@ type VersionedExtraOption struct { // flag is applied to GreaterThanOrEqual semver.Version } + +// ScheduledStopConfig contains information around scheduled stop +type ScheduledStopConfig struct { + InitiationTime int64 + Duration time.Duration +} diff --git a/pkg/minikube/localpath/localpath.go b/pkg/minikube/localpath/localpath.go index efbd489ca1..6d87c45d10 100644 --- a/pkg/minikube/localpath/localpath.go +++ b/pkg/minikube/localpath/localpath.go @@ -19,6 +19,7 @@ package localpath import ( "os" "os/exec" + "path" "path/filepath" "runtime" "strings" @@ -86,6 +87,11 @@ func ClientCert(name string) string { return new } +// PID returns the path to the pid file used by profile for scheduled stop +func PID(profile string) string { + return path.Join(Profile(profile), "pid") +} + // ClientKey returns client certificate path, used by kubeconfig func ClientKey(name string) string { new := filepath.Join(Profile(name), "client.key") diff --git a/pkg/minikube/reason/reason.go b/pkg/minikube/reason/reason.go index f90c1d98d8..9cce8f1af0 100644 --- a/pkg/minikube/reason/reason.go +++ b/pkg/minikube/reason/reason.go @@ -114,6 +114,7 @@ var ( InternalYamlMarshal = Kind{ID: "MK_YAML_MARSHAL", ExitCode: ExProgramError} InternalCredsNotFound = Kind{ID: "MK_CREDENTIALS_NOT_FOUND", ExitCode: ExProgramNotFound, Style: style.Shrug} InternalSemverParse = Kind{ID: "MK_SEMVER_PARSE", ExitCode: ExProgramError} + DaemonizeError = Kind{ID: "MK_DAEMONIZE", ExitCode: ExProgramError} RsrcInsufficientCores = Kind{ID: "RSRC_INSUFFICIENT_CORES", ExitCode: ExInsufficientCores, Style: style.UnmetRequirement} RsrcInsufficientDarwinDockerCores = Kind{ diff --git a/pkg/minikube/schedule/daemonize_unix.go b/pkg/minikube/schedule/daemonize_unix.go new file mode 100644 index 0000000000..308c2ec614 --- /dev/null +++ b/pkg/minikube/schedule/daemonize_unix.go @@ -0,0 +1,79 @@ +// +build !windows + +/* +Copyright 2020 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 schedule + +import ( + "fmt" + "io/ioutil" + "os" + "strconv" + "time" + + "github.com/VividCortex/godaemon" + "github.com/golang/glog" + "github.com/pkg/errors" + "k8s.io/minikube/pkg/minikube/localpath" +) + +func killExistingScheduledStops(profiles []string) error { + for _, profile := range profiles { + file := localpath.PID(profile) + f, err := ioutil.ReadFile(file) + if os.IsNotExist(err) { + return nil + } + defer os.Remove(file) + if err != nil { + return errors.Wrapf(err, "reading %s", file) + } + pid, err := strconv.Atoi(string(f)) + if err != nil { + return errors.Wrapf(err, "converting %v to int", string(f)) + } + p, err := os.FindProcess(pid) + if err != nil { + return errors.Wrap(err, "finding process") + } + glog.Infof("killing process %v as it is an old scheduled stop", pid) + if err := p.Kill(); err != nil { + return errors.Wrapf(err, "killing %v", pid) + } + } + return nil +} + +func daemonize(profiles []string, duration time.Duration) error { + _, _, err := godaemon.MakeDaemon(&godaemon.DaemonAttr{}) + if err != nil { + return err + } + // now that this process has daemonized, it has a new PID + pid := os.Getpid() + return savePIDs(pid, profiles) +} + +func savePIDs(pid int, profiles []string) error { + for _, p := range profiles { + file := localpath.PID(p) + if err := ioutil.WriteFile(file, []byte(fmt.Sprintf("%v", pid)), 0644); err != nil { + return err + } + } + return nil +} diff --git a/pkg/minikube/schedule/daemonize_windows.go b/pkg/minikube/schedule/daemonize_windows.go new file mode 100644 index 0000000000..178a28e920 --- /dev/null +++ b/pkg/minikube/schedule/daemonize_windows.go @@ -0,0 +1,32 @@ +// +build windows + +/* +Copyright 2020 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 schedule + +import ( + "fmt" + "time" +) + +func killExistingScheduledStops(profiles []string) error { + return fmt.Errorf("not yet implemented for windows") +} + +func daemonize(profiles []string, duration time.Duration) error { + return fmt.Errorf("not yet implemented for windows") +} diff --git a/pkg/minikube/schedule/schedule.go b/pkg/minikube/schedule/schedule.go new file mode 100644 index 0000000000..475dc6d340 --- /dev/null +++ b/pkg/minikube/schedule/schedule.go @@ -0,0 +1,47 @@ +/* +Copyright 2020 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 schedule + +import ( + "log" + "time" + + "github.com/pkg/errors" + "k8s.io/minikube/pkg/minikube/config" + "k8s.io/minikube/pkg/minikube/mustload" +) + +// Daemonize daemonizes minikube so that scheduled stop happens as expected +func Daemonize(profiles []string, duration time.Duration) error { + // save current time and expected duration in config + scheduledStop := &config.ScheduledStopConfig{ + InitiationTime: time.Now().Unix(), + Duration: duration, + } + if err := killExistingScheduledStops(profiles); err != nil { + log.Printf("error killing existing scheduled stops: %v", err) + } + for _, p := range profiles { + _, cc := mustload.Partial(p) + cc.ScheduledStop = scheduledStop + if err := config.SaveProfile(p, cc); err != nil { + return errors.Wrap(err, "saving profile") + } + } + + return daemonize(profiles, duration) +} diff --git a/test/integration/scheduled_stop_test.go b/test/integration/scheduled_stop_test.go new file mode 100644 index 0000000000..7e5d2e7a2a --- /dev/null +++ b/test/integration/scheduled_stop_test.go @@ -0,0 +1,114 @@ +// +build integration + +/* +Copyright 2020 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 integration + +import ( + "context" + "fmt" + "io/ioutil" + "os" + "os/exec" + "strconv" + "syscall" + "testing" + "time" + + "github.com/docker/machine/libmachine/state" + "k8s.io/minikube/pkg/minikube/localpath" + "k8s.io/minikube/pkg/util/retry" +) + +func TestScheduledStop(t *testing.T) { + profile := UniqueProfileName("scheduled-stop") + ctx, cancel := context.WithTimeout(context.Background(), Minutes(5)) + defer CleanupWithLogs(t, profile, cancel) + startMinikube(ctx, t, profile) + + // schedule a stop for 5 min from now and make sure PID is created + scheduledStopMinikube(ctx, t, profile, "5m") + pid := checkPID(t, profile) + if !processRunning(t, pid) { + t.Fatalf("process %v is not running", pid) + } + + // redo scheduled stop to be 3 min + scheduledStopMinikube(ctx, t, profile, "10s") + if processRunning(t, pid) { + t.Fatalf("process %v running but should have been killed on reschedule of stop", pid) + } + checkPID(t, profile) + // wait allotted time to make sure minikube status is "Stopped" + time.Sleep(15 * time.Second) + checkStatus := func() error { + got := Status(ctx, t, Target(), profile, "Host", profile) + if got != state.Stopped.String() { + return fmt.Errorf("expected post-stop host status to be -%q- but got *%q*", state.Stopped, got) + } + return nil + } + if err := retry.Expo(checkStatus, 100*time.Microsecond, 5*time.Second); err != nil { + t.Fatalf("error %v", err) + } +} + +func startMinikube(ctx context.Context, t *testing.T, profile string) { + args := append([]string{"start", "-p", profile}, StartArgs()...) + rr, err := Run(t, exec.CommandContext(ctx, Target(), args...)) + if err != nil { + t.Fatalf("starting minikube: %v\n%s", err, rr.Output()) + } +} + +func scheduledStopMinikube(ctx context.Context, t *testing.T, profile string, stop string) { + args := []string{"stop", "-p", profile, "--schedule", stop} + rr, err := Run(t, exec.CommandContext(ctx, Target(), args...)) + if err != nil { + t.Fatalf("starting minikube: %v\n%s", err, rr.Output()) + } +} + +func checkPID(t *testing.T, profile string) string { + file := localpath.PID(profile) + var contents []byte + getContents := func() error { + var err error + contents, err = ioutil.ReadFile(file) + return err + } + // first, make sure the PID file exists + if err := retry.Expo(getContents, 100*time.Microsecond, time.Minute*1); err != nil { + t.Fatalf("error reading %s: %v", file, err) + } + return string(contents) +} + +func processRunning(t *testing.T, pid string) bool { + // make sure PID file contains a running process + p, err := strconv.Atoi(pid) + if err != nil { + return false + } + process, err := os.FindProcess(p) + if err != nil { + return false + } + err = process.Signal(syscall.Signal(0)) + t.Log("signal error was: ", err) + return err == nil +} From 51b9f689b1383c4af24ae13d7f2fe14ae966f0fd Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 20 Oct 2020 13:51:35 -0700 Subject: [PATCH 02/18] replace glog with klog --- go.mod | 1 + pkg/minikube/schedule/daemonize_unix.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 271c87078d..0bd9c571eb 100644 --- a/go.mod +++ b/go.mod @@ -86,6 +86,7 @@ require ( k8s.io/api v0.17.4 k8s.io/apimachinery v0.17.4 k8s.io/client-go v0.17.4 + k8s.io/klog v1.0.0 k8s.io/klog/v2 v2.3.0 k8s.io/kubectl v0.0.0 k8s.io/kubernetes v1.18.5 diff --git a/pkg/minikube/schedule/daemonize_unix.go b/pkg/minikube/schedule/daemonize_unix.go index 308c2ec614..081a0b9c7d 100644 --- a/pkg/minikube/schedule/daemonize_unix.go +++ b/pkg/minikube/schedule/daemonize_unix.go @@ -26,8 +26,8 @@ import ( "time" "github.com/VividCortex/godaemon" - "github.com/golang/glog" "github.com/pkg/errors" + "k8s.io/klog" "k8s.io/minikube/pkg/minikube/localpath" ) @@ -50,7 +50,7 @@ func killExistingScheduledStops(profiles []string) error { if err != nil { return errors.Wrap(err, "finding process") } - glog.Infof("killing process %v as it is an old scheduled stop", pid) + klog.Infof("killing process %v as it is an old scheduled stop", pid) if err := p.Kill(); err != nil { return errors.Wrapf(err, "killing %v", pid) } From fd425d6b5e21a0d01141d56ed635423405b9dfc8 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 20 Oct 2020 13:56:58 -0700 Subject: [PATCH 03/18] fix klog --- pkg/minikube/schedule/daemonize_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/minikube/schedule/daemonize_unix.go b/pkg/minikube/schedule/daemonize_unix.go index 081a0b9c7d..abf6325713 100644 --- a/pkg/minikube/schedule/daemonize_unix.go +++ b/pkg/minikube/schedule/daemonize_unix.go @@ -27,7 +27,7 @@ import ( "github.com/VividCortex/godaemon" "github.com/pkg/errors" - "k8s.io/klog" + "k8s.io/klog/v2" "k8s.io/minikube/pkg/minikube/localpath" ) From 202e9c5afda7935ee1e469b23c826d5176660367 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 20 Oct 2020 14:15:57 -0700 Subject: [PATCH 04/18] improve integration test --- go.mod | 2 -- test/integration/scheduled_stop_test.go | 7 +++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 0bd9c571eb..6f28a49976 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,6 @@ require ( github.com/evanphx/json-patch v4.5.0+incompatible // indirect github.com/go-ole/go-ole v1.2.4 // indirect github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 - github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/google/go-cmp v0.4.1 github.com/google/go-containerregistry v0.0.0-20200601195303-96cf69f03a3c github.com/google/go-github v17.0.0+incompatible @@ -86,7 +85,6 @@ require ( k8s.io/api v0.17.4 k8s.io/apimachinery v0.17.4 k8s.io/client-go v0.17.4 - k8s.io/klog v1.0.0 k8s.io/klog/v2 v2.3.0 k8s.io/kubectl v0.0.0 k8s.io/kubernetes v1.18.5 diff --git a/test/integration/scheduled_stop_test.go b/test/integration/scheduled_stop_test.go index 7e5d2e7a2a..3cc937d9d1 100644 --- a/test/integration/scheduled_stop_test.go +++ b/test/integration/scheduled_stop_test.go @@ -36,7 +36,7 @@ import ( func TestScheduledStop(t *testing.T) { profile := UniqueProfileName("scheduled-stop") - ctx, cancel := context.WithTimeout(context.Background(), Minutes(5)) + ctx, _ := context.WithTimeout(context.Background(), Minutes(5)) defer CleanupWithLogs(t, profile, cancel) startMinikube(ctx, t, profile) @@ -47,14 +47,13 @@ func TestScheduledStop(t *testing.T) { t.Fatalf("process %v is not running", pid) } - // redo scheduled stop to be 3 min + // redo scheduled stop to be in 10s scheduledStopMinikube(ctx, t, profile, "10s") if processRunning(t, pid) { t.Fatalf("process %v running but should have been killed on reschedule of stop", pid) } checkPID(t, profile) // wait allotted time to make sure minikube status is "Stopped" - time.Sleep(15 * time.Second) checkStatus := func() error { got := Status(ctx, t, Target(), profile, "Host", profile) if got != state.Stopped.String() { @@ -62,7 +61,7 @@ func TestScheduledStop(t *testing.T) { } return nil } - if err := retry.Expo(checkStatus, 100*time.Microsecond, 5*time.Second); err != nil { + if err := retry.Expo(checkStatus, time.Second, 30*time.Second); err != nil { t.Fatalf("error %v", err) } } From 682df5036e4d4fc3d3707a950cac6a9f3a962eee Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 20 Oct 2020 14:26:15 -0700 Subject: [PATCH 05/18] fix lint --- test/integration/scheduled_stop_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/scheduled_stop_test.go b/test/integration/scheduled_stop_test.go index 3cc937d9d1..b11bdfec6c 100644 --- a/test/integration/scheduled_stop_test.go +++ b/test/integration/scheduled_stop_test.go @@ -36,7 +36,7 @@ import ( func TestScheduledStop(t *testing.T) { profile := UniqueProfileName("scheduled-stop") - ctx, _ := context.WithTimeout(context.Background(), Minutes(5)) + ctx, cancel := context.WithTimeout(context.Background(), Minutes(5)) defer CleanupWithLogs(t, profile, cancel) startMinikube(ctx, t, profile) From b9adc95f6ac04470f6516e175bb8ea4d272bb322 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 20 Oct 2020 15:00:56 -0700 Subject: [PATCH 06/18] Update docs --- site/content/en/docs/commands/stop.md | 1 + 1 file changed, 1 insertion(+) diff --git a/site/content/en/docs/commands/stop.md b/site/content/en/docs/commands/stop.md index 1fbadc44c3..5c67313d06 100644 --- a/site/content/en/docs/commands/stop.md +++ b/site/content/en/docs/commands/stop.md @@ -23,6 +23,7 @@ minikube stop [flags] --all Set flag to stop all profiles (clusters) -h, --help help for stop --keep-context-active keep the kube-context active after cluster is stopped. Defaults to false. + --schedule string Set flag to stop cluster after a set amount of time (e.g. --schedule=5m) ``` ### Options inherited from parent commands From 44f033d53198a3545b66b97e67e248c319ddb968 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Fri, 23 Oct 2020 15:26:48 -0700 Subject: [PATCH 07/18] Replace godaemon library with fork --- go.mod | 1 + go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index 6f28a49976..6e21fa57a2 100644 --- a/go.mod +++ b/go.mod @@ -99,6 +99,7 @@ replace ( github.com/google/go-containerregistry => github.com/afbjorklund/go-containerregistry v0.0.0-20200902152226-fbad78ec2813 github.com/hashicorp/go-getter => github.com/afbjorklund/go-getter v1.4.1-0.20190910175809-eb9f6c26742c github.com/samalba/dockerclient => github.com/sayboras/dockerclient v1.0.0 + github.com/VividCortex/godaemon => github.com/priyawadhwa/godaemon v0.0.0-20201023222158-5d5ea5b0cb72 k8s.io/api => k8s.io/api v0.17.3 k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.3 k8s.io/apimachinery => k8s.io/apimachinery v0.17.3 diff --git a/go.sum b/go.sum index 7ce3e995e0..15c20043c9 100644 --- a/go.sum +++ b/go.sum @@ -939,6 +939,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/pquerna/ffjson v0.0.0-20180717144149-af8b230fcd20/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M= +github.com/priyawadhwa/godaemon v0.0.0-20201023222158-5d5ea5b0cb72 h1:o2K9V8zGFZar9fr3qW2ikKehvGCcjf16n+MNxoaPKHM= +github.com/priyawadhwa/godaemon v0.0.0-20201023222158-5d5ea5b0cb72/go.mod h1:gsvY6bap8CdyOgacVBjhKgiFKriJyaLiq7EOTd7Of6E= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM= From 02f03af1010fcaa95ff97177a8ac994c57e6e763 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 26 Oct 2020 15:17:24 -0700 Subject: [PATCH 08/18] exit if using --schedule with windows as it is not yet supported --- cmd/minikube/cmd/stop.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/minikube/cmd/stop.go b/cmd/minikube/cmd/stop.go index f715db0473..5e3dc5a25f 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -17,6 +17,7 @@ limitations under the License. package cmd import ( + "runtime" "time" "github.com/docker/machine/libmachine" @@ -85,6 +86,9 @@ func runStop(cmd *cobra.Command, args []string) { } if scheduledStop != "" { + if runtime.GOOS == "windows" { + exit.Message(reason.Usage, "the --schedule flag is currently not supported on windows") + } duration, err := time.ParseDuration(scheduledStop) if err != nil { exit.Message(reason.Usage, "provided value {{.schedule}} to --schedule is not a valid Golang time.Duration", out.V{"schedule": scheduledStop}) From a2d00e534d7340ca2673f1558a945b95e542518d Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Fri, 30 Oct 2020 11:19:13 -0700 Subject: [PATCH 09/18] remove my forked dependency now that https://github.com/VividCortex/godaemon/pull/28 merged --- go.mod | 3 +-- go.sum | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 9b93ad4766..e7ed59ae10 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 // indirect github.com/Parallels/docker-machine-parallels v1.3.0 github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect - github.com/VividCortex/godaemon v0.0.0-20200629145737-581b70a8a603 + github.com/VividCortex/godaemon v0.0.0-20201030160542-15e3f4925a21 github.com/blang/semver v3.5.0+incompatible github.com/c4milo/gotoolkit v0.0.0-20170318115440-bcc06269efa9 // indirect github.com/cenkalti/backoff v2.2.1+incompatible @@ -100,7 +100,6 @@ replace ( github.com/google/go-containerregistry => github.com/afbjorklund/go-containerregistry v0.0.0-20200902152226-fbad78ec2813 github.com/hashicorp/go-getter => github.com/afbjorklund/go-getter v1.4.1-0.20201020145846-c0da14b4bffe github.com/samalba/dockerclient => github.com/sayboras/dockerclient v1.0.0 - github.com/VividCortex/godaemon => github.com/priyawadhwa/godaemon v0.0.0-20201023222158-5d5ea5b0cb72 k8s.io/api => k8s.io/api v0.17.3 k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.3 k8s.io/apimachinery => k8s.io/apimachinery v0.17.3 diff --git a/go.sum b/go.sum index ba9bba4481..caa573e40d 100644 --- a/go.sum +++ b/go.sum @@ -120,6 +120,8 @@ github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdc github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA= github.com/VividCortex/godaemon v0.0.0-20200629145737-581b70a8a603 h1:ZqOqBuBJ9QfCo2ErNFCVh5UXWtwXu01xb/WX1ND0rPM= github.com/VividCortex/godaemon v0.0.0-20200629145737-581b70a8a603/go.mod h1:Y8CJ3IwPIAkMhv/rRUWIlczaeqd9ty9yrl+nc2AbaL4= +github.com/VividCortex/godaemon v0.0.0-20201030160542-15e3f4925a21 h1:Pgxfz/g+XyfRjYqRjKUFpDh5IciFncmA/Uio6AU/z9g= +github.com/VividCortex/godaemon v0.0.0-20201030160542-15e3f4925a21/go.mod h1:Y8CJ3IwPIAkMhv/rRUWIlczaeqd9ty9yrl+nc2AbaL4= github.com/afbjorklund/go-containerregistry v0.0.0-20200902152226-fbad78ec2813 h1:0tskN1ipU/BBrpoEIy0rdZS9jf5+wdP6IMRak8Iu/YE= github.com/afbjorklund/go-containerregistry v0.0.0-20200902152226-fbad78ec2813/go.mod h1:npTSyywOeILcgWqd+rvtzGWflIPPcBQhYoOONaY4ltM= github.com/afbjorklund/go-getter v1.4.1-0.20201020145846-c0da14b4bffe h1:TdcuDqk4ArmYI8cbeeL/RM5BPciDOaWpGZoPoT3OziQ= From a00b7a38e29a71e71f7ebf80f35692184f298429 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Fri, 6 Nov 2020 11:58:21 -0800 Subject: [PATCH 10/18] Use DurationVar instead of StringVar for flag --- cmd/minikube/cmd/stop.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/cmd/minikube/cmd/stop.go b/cmd/minikube/cmd/stop.go index 39ba37c7db..cefbbd418b 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -42,9 +42,9 @@ import ( ) var ( - stopAll bool - keepActive bool - scheduledStop string + stopAll bool + keepActive bool + scheduledStopDuration time.Duration ) // stopCmd represents the stop command @@ -58,7 +58,7 @@ var stopCmd = &cobra.Command{ func init() { stopCmd.Flags().BoolVar(&stopAll, "all", false, "Set flag to stop all profiles (clusters)") stopCmd.Flags().BoolVar(&keepActive, "keep-context-active", false, "keep the kube-context active after cluster is stopped. Defaults to false.") - stopCmd.Flags().StringVar(&scheduledStop, "schedule", "", "Set flag to stop cluster after a set amount of time (e.g. --schedule=5m)") + stopCmd.Flags().DurationVar(&scheduledStopDuration, "schedule", 0*time.Second, "Set flag to stop cluster after a set amount of time (e.g. --schedule=5m)") stopCmd.Flags().StringVarP(&outputFormat, "output", "o", "text", "Format to print stdout in. Options include: [text,json]") if err := viper.GetViper().BindPFlags(stopCmd.Flags()); err != nil { @@ -87,19 +87,15 @@ func runStop(cmd *cobra.Command, args []string) { profilesToStop = append(profilesToStop, cname) } - if scheduledStop != "" { + if scheduledStopDuration != 0 { if runtime.GOOS == "windows" { exit.Message(reason.Usage, "the --schedule flag is currently not supported on windows") } - duration, err := time.ParseDuration(scheduledStop) - if err != nil { - exit.Message(reason.Usage, "provided value {{.schedule}} to --schedule is not a valid Golang time.Duration", out.V{"schedule": scheduledStop}) - } - if err := schedule.Daemonize(profilesToStop, duration); err != nil { + if err := schedule.Daemonize(profilesToStop, scheduledStopDuration); err != nil { exit.Message(reason.DaemonizeError, "unable to daemonize: {{.err}}", out.V{"err": err.Error()}) } - klog.Infof("sleeping %s before completing stop...", duration.String()) - time.Sleep(duration) + klog.Infof("sleeping %s before completing stop...", scheduledStopDuration.String()) + time.Sleep(scheduledStopDuration) } stoppedNodes := 0 From 129f6d4a225a02b4bee0e470d933909908733dae Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Fri, 6 Nov 2020 11:59:46 -0800 Subject: [PATCH 11/18] go mod tidy --- go.sum | 4 ---- 1 file changed, 4 deletions(-) diff --git a/go.sum b/go.sum index 74b9fff6ab..22abe6c76e 100644 --- a/go.sum +++ b/go.sum @@ -118,8 +118,6 @@ github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUW github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM= github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA= -github.com/VividCortex/godaemon v0.0.0-20200629145737-581b70a8a603 h1:ZqOqBuBJ9QfCo2ErNFCVh5UXWtwXu01xb/WX1ND0rPM= -github.com/VividCortex/godaemon v0.0.0-20200629145737-581b70a8a603/go.mod h1:Y8CJ3IwPIAkMhv/rRUWIlczaeqd9ty9yrl+nc2AbaL4= github.com/VividCortex/godaemon v0.0.0-20201030160542-15e3f4925a21 h1:Pgxfz/g+XyfRjYqRjKUFpDh5IciFncmA/Uio6AU/z9g= github.com/VividCortex/godaemon v0.0.0-20201030160542-15e3f4925a21/go.mod h1:Y8CJ3IwPIAkMhv/rRUWIlczaeqd9ty9yrl+nc2AbaL4= github.com/afbjorklund/go-containerregistry v0.0.0-20200902152226-fbad78ec2813 h1:0tskN1ipU/BBrpoEIy0rdZS9jf5+wdP6IMRak8Iu/YE= @@ -951,8 +949,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/pquerna/ffjson v0.0.0-20180717144149-af8b230fcd20/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M= -github.com/priyawadhwa/godaemon v0.0.0-20201023222158-5d5ea5b0cb72 h1:o2K9V8zGFZar9fr3qW2ikKehvGCcjf16n+MNxoaPKHM= -github.com/priyawadhwa/godaemon v0.0.0-20201023222158-5d5ea5b0cb72/go.mod h1:gsvY6bap8CdyOgacVBjhKgiFKriJyaLiq7EOTd7Of6E= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM= From 0ee5a38681da618980ec42c251c0fc9dad2efe00 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Fri, 6 Nov 2020 13:42:15 -0800 Subject: [PATCH 12/18] update docs --- site/content/en/docs/commands/addons.md | 39 ++++--------------- site/content/en/docs/commands/cache.md | 37 +++--------------- site/content/en/docs/commands/completion.md | 7 +--- site/content/en/docs/commands/config.md | 39 ++++--------------- site/content/en/docs/commands/dashboard.md | 4 +- site/content/en/docs/commands/delete.md | 2 +- site/content/en/docs/commands/docker-env.md | 2 +- site/content/en/docs/commands/help.md | 7 +--- site/content/en/docs/commands/ip.md | 7 +--- site/content/en/docs/commands/kubectl.md | 7 +--- site/content/en/docs/commands/logs.md | 2 +- site/content/en/docs/commands/mount.md | 2 +- site/content/en/docs/commands/node.md | 39 ++++--------------- site/content/en/docs/commands/pause.md | 2 +- site/content/en/docs/commands/podman-env.md | 2 +- site/content/en/docs/commands/profile.md | 16 ++------ site/content/en/docs/commands/service.md | 11 ++---- site/content/en/docs/commands/ssh-key.md | 7 +--- site/content/en/docs/commands/ssh.md | 2 +- site/content/en/docs/commands/start.md | 2 +- site/content/en/docs/commands/status.md | 2 +- site/content/en/docs/commands/stop.md | 4 +- site/content/en/docs/commands/tunnel.md | 2 +- site/content/en/docs/commands/unpause.md | 2 +- site/content/en/docs/commands/update-check.md | 7 +--- .../en/docs/commands/update-context.md | 7 +--- site/content/en/docs/commands/version.md | 2 +- 27 files changed, 56 insertions(+), 206 deletions(-) diff --git a/site/content/en/docs/commands/addons.md b/site/content/en/docs/commands/addons.md index d72137ec18..621179f56f 100644 --- a/site/content/en/docs/commands/addons.md +++ b/site/content/en/docs/commands/addons.md @@ -17,18 +17,13 @@ addons modifies minikube addons files using subcommands like "minikube addons en minikube addons SUBCOMMAND [flags] ``` -### Options - -``` - -h, --help help for addons -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -55,18 +50,13 @@ Configures the addon w/ADDON_NAME within minikube (example: minikube addons conf minikube addons configure ADDON_NAME [flags] ``` -### Options - -``` - -h, --help help for configure -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -93,18 +83,13 @@ Disables the addon w/ADDON_NAME within minikube (example: minikube addons disabl minikube addons disable ADDON_NAME [flags] ``` -### Options - -``` - -h, --help help for disable -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -131,18 +116,13 @@ Enables the addon w/ADDON_NAME within minikube (example: minikube addons enable minikube addons enable ADDON_NAME [flags] ``` -### Options - -``` - -h, --help help for enable -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -170,18 +150,13 @@ Simply type addons help [path to command] for full details. minikube addons help [command] [flags] ``` -### Options - -``` - -h, --help help for help -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -211,7 +186,6 @@ minikube addons list [flags] ### Options ``` - -h, --help help for list -o, --output string minikube addons list --output OUTPUT. json, list (default "list") ``` @@ -221,6 +195,7 @@ minikube addons list [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -251,7 +226,6 @@ minikube addons open ADDON_NAME [flags] ``` --format string Format to output addons URL in. This format will be applied to each url individually and they will be printed one at a time. (default "http://{{.IP}}:{{.Port}}") - -h, --help help for open --https Open the addons URL with https instead of http --interval int The time interval for each check that wait performs in seconds (default 1) --url Display the Kubernetes addons URL in the CLI instead of opening it in the default browser @@ -264,6 +238,7 @@ minikube addons open ADDON_NAME [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/cache.md b/site/content/en/docs/commands/cache.md index 25e0e8cf30..3917b19b70 100644 --- a/site/content/en/docs/commands/cache.md +++ b/site/content/en/docs/commands/cache.md @@ -13,18 +13,13 @@ Add, delete, or push a local image into minikube Add, delete, or push a local image into minikube -### Options - -``` - -h, --help help for cache -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -51,18 +46,13 @@ Add an image to local cache. minikube cache add [flags] ``` -### Options - -``` - -h, --help help for add -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -89,18 +79,13 @@ Delete an image from the local cache. minikube cache delete [flags] ``` -### Options - -``` - -h, --help help for delete -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -128,18 +113,13 @@ Simply type cache help [path to command] for full details. minikube cache help [command] [flags] ``` -### Options - -``` - -h, --help help for help -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -171,7 +151,6 @@ minikube cache list [flags] ``` --format string Go template format string for the cache list output. The format for Go templates can be found here: https://golang.org/pkg/text/template/ For the list of accessible variables for the template, see the struct values here: https://godoc.org/k8s.io/minikube/cmd/minikube/cmd#CacheListTemplate (default "{{.CacheImage}}\n") - -h, --help help for list ``` ### Options inherited from parent commands @@ -180,6 +159,7 @@ minikube cache list [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -206,18 +186,13 @@ reloads images previously added using the 'cache add' subcommand minikube cache reload [flags] ``` -### Options - -``` - -h, --help help for reload -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/completion.md b/site/content/en/docs/commands/completion.md index 28912b6968..7738a2e216 100644 --- a/site/content/en/docs/commands/completion.md +++ b/site/content/en/docs/commands/completion.md @@ -38,18 +38,13 @@ Outputs minikube shell completion for the given shell (bash, zsh or fish) minikube completion SHELL [flags] ``` -### Options - -``` - -h, --help help for completion -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/config.md b/site/content/en/docs/commands/config.md index 7670320985..8e66d3f193 100644 --- a/site/content/en/docs/commands/config.md +++ b/site/content/en/docs/commands/config.md @@ -47,18 +47,13 @@ Configurable fields: minikube config SUBCOMMAND [flags] ``` -### Options - -``` - -h, --help help for config -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -91,7 +86,6 @@ minikube config defaults PROPERTY_NAME [flags] ### Options ``` - -h, --help help for defaults --output string Output format. Accepted values: [json] ``` @@ -101,6 +95,7 @@ minikube config defaults PROPERTY_NAME [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -127,18 +122,13 @@ Returns the value of PROPERTY_NAME from the minikube config file. Can be overwr minikube config get PROPERTY_NAME [flags] ``` -### Options - -``` - -h, --help help for get -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -166,18 +156,13 @@ Simply type config help [path to command] for full details. minikube config help [command] [flags] ``` -### Options - -``` - -h, --help help for help -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -205,18 +190,13 @@ Sets the PROPERTY_NAME config value to PROPERTY_VALUE minikube config set PROPERTY_NAME PROPERTY_VALUE [flags] ``` -### Options - -``` - -h, --help help for set -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -243,18 +223,13 @@ unsets PROPERTY_NAME from the minikube config file. Can be overwritten by flags minikube config unset PROPERTY_NAME [flags] ``` -### Options - -``` - -h, --help help for unset -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -286,7 +261,6 @@ minikube config view [flags] ``` --format string Go template format string for the config view output. The format for Go templates can be found here: https://golang.org/pkg/text/template/ For the list of accessible variables for the template, see the struct values here: https://godoc.org/k8s.io/minikube/cmd/minikube/cmd/config#ConfigViewTemplate (default "- {{.ConfigKey}}: {{.ConfigValue}}\n") - -h, --help help for view ``` ### Options inherited from parent commands @@ -295,6 +269,7 @@ minikube config view [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/dashboard.md b/site/content/en/docs/commands/dashboard.md index 8272beb8e0..8df23e2c93 100644 --- a/site/content/en/docs/commands/dashboard.md +++ b/site/content/en/docs/commands/dashboard.md @@ -20,8 +20,7 @@ minikube dashboard [flags] ### Options ``` - -h, --help help for dashboard - --url Display dashboard URL instead of opening a browser + --url Display dashboard URL instead of opening a browser ``` ### Options inherited from parent commands @@ -30,6 +29,7 @@ minikube dashboard [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/delete.md b/site/content/en/docs/commands/delete.md index 768c24de05..34cea14518 100644 --- a/site/content/en/docs/commands/delete.md +++ b/site/content/en/docs/commands/delete.md @@ -22,7 +22,6 @@ minikube delete [flags] ``` --all Set flag to delete all profiles - -h, --help help for delete --purge Set this flag to delete the '.minikube' folder from your user directory. ``` @@ -32,6 +31,7 @@ minikube delete [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/docker-env.md b/site/content/en/docs/commands/docker-env.md index 5b0e721869..7ce914a063 100644 --- a/site/content/en/docs/commands/docker-env.md +++ b/site/content/en/docs/commands/docker-env.md @@ -20,7 +20,6 @@ minikube docker-env [flags] ### Options ``` - -h, --help help for docker-env --no-proxy Add machine IP to NO_PROXY environment variable --shell string Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect -u, --unset Unset variables instead of setting them @@ -32,6 +31,7 @@ minikube docker-env [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/help.md b/site/content/en/docs/commands/help.md index f0c808fcf3..6f25e68ca8 100644 --- a/site/content/en/docs/commands/help.md +++ b/site/content/en/docs/commands/help.md @@ -18,18 +18,13 @@ Simply type minikube help [path to command] for full details. minikube help [command] [flags] ``` -### Options - -``` - -h, --help help for help -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/ip.md b/site/content/en/docs/commands/ip.md index 559274c346..0a14345642 100644 --- a/site/content/en/docs/commands/ip.md +++ b/site/content/en/docs/commands/ip.md @@ -17,18 +17,13 @@ Retrieves the IP address of the running cluster, and writes it to STDOUT. minikube ip [flags] ``` -### Options - -``` - -h, --help help for ip -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/kubectl.md b/site/content/en/docs/commands/kubectl.md index f098a66e65..a787c52b5b 100644 --- a/site/content/en/docs/commands/kubectl.md +++ b/site/content/en/docs/commands/kubectl.md @@ -21,18 +21,13 @@ minikube kubectl -- get pods --namespace kube-system minikube kubectl [flags] ``` -### Options - -``` - -h, --help help for kubectl -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/logs.md b/site/content/en/docs/commands/logs.md index 148d186e5b..1734f8b7b9 100644 --- a/site/content/en/docs/commands/logs.md +++ b/site/content/en/docs/commands/logs.md @@ -21,7 +21,6 @@ minikube logs [flags] ``` -f, --follow Show only the most recent journal entries, and continuously print new entries as they are appended to the journal. - -h, --help help for logs -n, --length int Number of lines back to go within the log (default 60) --node string The node to get logs from. Defaults to the primary control plane. --problems Show only log entries which point to known problems @@ -33,6 +32,7 @@ minikube logs [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/mount.md b/site/content/en/docs/commands/mount.md index 33161f7a61..8d9decd590 100644 --- a/site/content/en/docs/commands/mount.md +++ b/site/content/en/docs/commands/mount.md @@ -22,7 +22,6 @@ minikube mount [flags] : ``` --9p-version string Specify the 9p version that the mount should use (default "9p2000.L") --gid string Default group id used for the mount (default "docker") - -h, --help help for mount --ip string Specify the ip that the mount should be setup on --kill Kill the mount process spawned by minikube start --mode uint File permissions used for the mount (default 493) @@ -38,6 +37,7 @@ minikube mount [flags] : --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/node.md b/site/content/en/docs/commands/node.md index 94b8fbf485..e7c22ec26c 100644 --- a/site/content/en/docs/commands/node.md +++ b/site/content/en/docs/commands/node.md @@ -17,18 +17,13 @@ Operations on nodes minikube node [flags] ``` -### Options - -``` - -h, --help help for node -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -60,7 +55,6 @@ minikube node add [flags] ``` --control-plane If true, the node added will also be a control plane in addition to a worker. --delete-on-failure If set, delete the current cluster if start fails and try again. Defaults to false. - -h, --help help for add --worker If true, the added node will be marked for work. Defaults to true. (default true) ``` @@ -70,6 +64,7 @@ minikube node add [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -96,18 +91,13 @@ Deletes a node from a cluster. minikube node delete [flags] ``` -### Options - -``` - -h, --help help for delete -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -135,18 +125,13 @@ Simply type node help [path to command] for full details. minikube node help [command] [flags] ``` -### Options - -``` - -h, --help help for help -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -173,18 +158,13 @@ List existing minikube nodes. minikube node list [flags] ``` -### Options - -``` - -h, --help help for list -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -215,7 +195,6 @@ minikube node start [flags] ``` --delete-on-failure If set, delete the current cluster if start fails and try again. Defaults to false. - -h, --help help for start ``` ### Options inherited from parent commands @@ -224,6 +203,7 @@ minikube node start [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -250,18 +230,13 @@ Stops a node in a cluster. minikube node stop [flags] ``` -### Options - -``` - -h, --help help for stop -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/pause.md b/site/content/en/docs/commands/pause.md index d1b2e04b5a..26938f43a2 100644 --- a/site/content/en/docs/commands/pause.md +++ b/site/content/en/docs/commands/pause.md @@ -22,7 +22,6 @@ minikube pause [flags] ``` -n, ----namespaces strings namespaces to pause (default [kube-system,kubernetes-dashboard,storage-gluster,istio-operator]) -A, --all-namespaces If set, pause all namespaces - -h, --help help for pause -o, --output string Format to print stdout in. Options include: [text,json] (default "text") ``` @@ -32,6 +31,7 @@ minikube pause [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/podman-env.md b/site/content/en/docs/commands/podman-env.md index bb71277a2d..ef94b796b3 100644 --- a/site/content/en/docs/commands/podman-env.md +++ b/site/content/en/docs/commands/podman-env.md @@ -20,7 +20,6 @@ minikube podman-env [flags] ### Options ``` - -h, --help help for podman-env --shell string Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect -u, --unset Unset variables instead of setting them ``` @@ -31,6 +30,7 @@ minikube podman-env [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/profile.md b/site/content/en/docs/commands/profile.md index d7804d2b16..eb1ea697a3 100644 --- a/site/content/en/docs/commands/profile.md +++ b/site/content/en/docs/commands/profile.md @@ -17,18 +17,13 @@ profile sets the current minikube profile, or gets the current profile if no arg minikube profile [MINIKUBE_PROFILE_NAME]. You can return to the default minikube profile by running `minikube profile default` [flags] ``` -### Options - -``` - -h, --help help for profile -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -56,18 +51,13 @@ Simply type profile help [path to command] for full details. minikube profile help [command] [flags] ``` -### Options - -``` - -h, --help help for help -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -97,7 +87,6 @@ minikube profile list [flags] ### Options ``` - -h, --help help for list -o, --output string The output format. One of 'json', 'table' (default "table") ``` @@ -107,6 +96,7 @@ minikube profile list [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/service.md b/site/content/en/docs/commands/service.md index 3317399765..c387e9f637 100644 --- a/site/content/en/docs/commands/service.md +++ b/site/content/en/docs/commands/service.md @@ -21,7 +21,6 @@ minikube service [flags] SERVICE ``` --format string Format to output service URL in. This format will be applied to each url individually and they will be printed one at a time. (default "http://{{.IP}}:{{.Port}}") - -h, --help help for service --https Open the service URL with https instead of http (defaults to "false") --interval int The initial time interval for each check that wait performs in seconds (default 1) -n, --namespace string The service namespace (default "default") @@ -35,6 +34,7 @@ minikube service [flags] SERVICE --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -62,12 +62,6 @@ Simply type service help [path to command] for full details. minikube service help [command] [flags] ``` -### Options - -``` - -h, --help help for help -``` - ### Options inherited from parent commands ``` @@ -75,6 +69,7 @@ minikube service help [command] [flags] --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") --format string Format to output service URL in. This format will be applied to each url individually and they will be printed one at a time. (default "http://{{.IP}}:{{.Port}}") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file @@ -104,7 +99,6 @@ minikube service list [flags] ### Options ``` - -h, --help help for list -n, --namespace string The services namespace ``` @@ -115,6 +109,7 @@ minikube service list [flags] --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") --format string Format to output service URL in. This format will be applied to each url individually and they will be printed one at a time. (default "http://{{.IP}}:{{.Port}}") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/ssh-key.md b/site/content/en/docs/commands/ssh-key.md index 7398280c21..89d84187f0 100644 --- a/site/content/en/docs/commands/ssh-key.md +++ b/site/content/en/docs/commands/ssh-key.md @@ -17,18 +17,13 @@ Retrieve the ssh identity key path of the specified cluster. minikube ssh-key [flags] ``` -### Options - -``` - -h, --help help for ssh-key -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/ssh.md b/site/content/en/docs/commands/ssh.md index 5953124b8c..3a00f98d1e 100644 --- a/site/content/en/docs/commands/ssh.md +++ b/site/content/en/docs/commands/ssh.md @@ -20,7 +20,6 @@ minikube ssh [flags] ### Options ``` - -h, --help help for ssh --native-ssh Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh' command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for SSH'. (default true) -n, --node string The node to ssh into. Defaults to the primary control plane. ``` @@ -31,6 +30,7 @@ minikube ssh [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/start.md b/site/content/en/docs/commands/start.md index f828d83aa3..776faaf423 100644 --- a/site/content/en/docs/commands/start.md +++ b/site/content/en/docs/commands/start.md @@ -51,7 +51,6 @@ minikube start [flags] --feature-gates string A set of key=value pairs that describe feature gates for alpha/experimental features. --force Force minikube to perform possibly dangerous operations --force-systemd If set, force the container runtime to use sytemd as cgroup manager. Currently available for docker and crio. Defaults to false. - -h, --help help for start --host-dns-resolver Enable host resolver for NAT DNS requests (virtualbox driver only) (default true) --host-only-cidr string The CIDR to be used for the minikube VM (virtualbox driver only) (default "192.168.99.1/24") --host-only-nic-type string NIC Type used for host only network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only) (default "virtio") @@ -101,6 +100,7 @@ minikube start [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/status.md b/site/content/en/docs/commands/status.md index a7197fa4c2..f8ca0b73e9 100644 --- a/site/content/en/docs/commands/status.md +++ b/site/content/en/docs/commands/status.md @@ -24,7 +24,6 @@ minikube status [flags] ``` -f, --format string Go template format string for the status output. The format for Go templates can be found here: https://golang.org/pkg/text/template/ For the list accessible variables for the template, see the struct values here: https://godoc.org/k8s.io/minikube/cmd/minikube/cmd#Status (default "{{.Name}}\ntype: Control Plane\nhost: {{.Host}}\nkubelet: {{.Kubelet}}\napiserver: {{.APIServer}}\nkubeconfig: {{.Kubeconfig}}\n\n") - -h, --help help for status -l, --layout string output layout (EXPERIMENTAL, JSON only): 'nodes' or 'cluster' (default "nodes") -n, --node string The node to check status for. Defaults to control plane. Leave blank with default format for status on all nodes. -o, --output string minikube status --output OUTPUT. json, text (default "text") @@ -36,6 +35,7 @@ minikube status [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/stop.md b/site/content/en/docs/commands/stop.md index d3f4904bd5..0437f35eb1 100644 --- a/site/content/en/docs/commands/stop.md +++ b/site/content/en/docs/commands/stop.md @@ -21,10 +21,9 @@ minikube stop [flags] ``` --all Set flag to stop all profiles (clusters) - -h, --help help for stop --keep-context-active keep the kube-context active after cluster is stopped. Defaults to false. -o, --output string Format to print stdout in. Options include: [text,json] (default "text") - --schedule string Set flag to stop cluster after a set amount of time (e.g. --schedule=5m) + --schedule duration Set flag to stop cluster after a set amount of time (e.g. --schedule=5m) ``` ### Options inherited from parent commands @@ -33,6 +32,7 @@ minikube stop [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/tunnel.md b/site/content/en/docs/commands/tunnel.md index 3e85c936d4..370e8128dc 100644 --- a/site/content/en/docs/commands/tunnel.md +++ b/site/content/en/docs/commands/tunnel.md @@ -21,7 +21,6 @@ minikube tunnel [flags] ``` -c, --cleanup call with cleanup=true to remove old tunnels (default true) - -h, --help help for tunnel ``` ### Options inherited from parent commands @@ -30,6 +29,7 @@ minikube tunnel [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/unpause.md b/site/content/en/docs/commands/unpause.md index 5bdda4ac91..aabcedf80b 100644 --- a/site/content/en/docs/commands/unpause.md +++ b/site/content/en/docs/commands/unpause.md @@ -22,7 +22,6 @@ minikube unpause [flags] ``` -n, ----namespaces strings namespaces to unpause (default [kube-system,kubernetes-dashboard,storage-gluster,istio-operator]) -A, --all-namespaces If set, unpause all namespaces - -h, --help help for unpause -o, --output string Format to print stdout in. Options include: [text,json] (default "text") ``` @@ -32,6 +31,7 @@ minikube unpause [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/update-check.md b/site/content/en/docs/commands/update-check.md index cb51afd7f9..b3d98bb1bb 100644 --- a/site/content/en/docs/commands/update-check.md +++ b/site/content/en/docs/commands/update-check.md @@ -17,18 +17,13 @@ Print current and latest version number minikube update-check [flags] ``` -### Options - -``` - -h, --help help for update-check -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/update-context.md b/site/content/en/docs/commands/update-context.md index 7737bf279f..b981dbeba5 100644 --- a/site/content/en/docs/commands/update-context.md +++ b/site/content/en/docs/commands/update-context.md @@ -18,18 +18,13 @@ Retrieves the IP address of the running cluster, checks it minikube update-context [flags] ``` -### Options - -``` - -h, --help help for update-context -``` - ### Options inherited from parent commands ``` --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file diff --git a/site/content/en/docs/commands/version.md b/site/content/en/docs/commands/version.md index b63ac64550..d1fc7e06aa 100644 --- a/site/content/en/docs/commands/version.md +++ b/site/content/en/docs/commands/version.md @@ -20,7 +20,6 @@ minikube version [flags] ### Options ``` - -h, --help help for version -o, --output string One of 'yaml' or 'json'. --short Print just the version number. ``` @@ -31,6 +30,7 @@ minikube version [flags] --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files -b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm") + -h, --help --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --log_file string If non-empty, use this log file From cf1ee6b07265fcba3a57dc0606889003322d664b Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 9 Nov 2020 13:33:18 -0800 Subject: [PATCH 13/18] Address review comments --- cmd/minikube/cmd/stop.go | 7 +++++++ pkg/minikube/schedule/daemonize_unix.go | 3 ++- pkg/minikube/schedule/daemonize_windows.go | 3 ++- pkg/minikube/schedule/schedule.go | 10 ++++++---- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/cmd/minikube/cmd/stop.go b/cmd/minikube/cmd/stop.go index cefbbd418b..44c4238efd 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -17,6 +17,7 @@ limitations under the License. package cmd import ( + "log" "runtime" "time" @@ -59,6 +60,7 @@ func init() { stopCmd.Flags().BoolVar(&stopAll, "all", false, "Set flag to stop all profiles (clusters)") stopCmd.Flags().BoolVar(&keepActive, "keep-context-active", false, "keep the kube-context active after cluster is stopped. Defaults to false.") stopCmd.Flags().DurationVar(&scheduledStopDuration, "schedule", 0*time.Second, "Set flag to stop cluster after a set amount of time (e.g. --schedule=5m)") + stopCmd.Flags().MarkHidden("schedule") stopCmd.Flags().StringVarP(&outputFormat, "output", "o", "text", "Format to print stdout in. Options include: [text,json]") if err := viper.GetViper().BindPFlags(stopCmd.Flags()); err != nil { @@ -87,6 +89,11 @@ func runStop(cmd *cobra.Command, args []string) { profilesToStop = append(profilesToStop, cname) } + // Kill any existing scheduled stops + if err := schedule.KillExisting(profilesToStop); err != nil { + log.Printf("error killing existing scheduled stops: %v", err) + } + if scheduledStopDuration != 0 { if runtime.GOOS == "windows" { exit.Message(reason.Usage, "the --schedule flag is currently not supported on windows") diff --git a/pkg/minikube/schedule/daemonize_unix.go b/pkg/minikube/schedule/daemonize_unix.go index abf6325713..4f52a7621d 100644 --- a/pkg/minikube/schedule/daemonize_unix.go +++ b/pkg/minikube/schedule/daemonize_unix.go @@ -31,7 +31,8 @@ import ( "k8s.io/minikube/pkg/minikube/localpath" ) -func killExistingScheduledStops(profiles []string) error { +// KillExisting kills existing scheduled stops +func KillExisting(profiles []string) error { for _, profile := range profiles { file := localpath.PID(profile) f, err := ioutil.ReadFile(file) diff --git a/pkg/minikube/schedule/daemonize_windows.go b/pkg/minikube/schedule/daemonize_windows.go index 178a28e920..7744c9d26f 100644 --- a/pkg/minikube/schedule/daemonize_windows.go +++ b/pkg/minikube/schedule/daemonize_windows.go @@ -23,7 +23,8 @@ import ( "time" ) -func killExistingScheduledStops(profiles []string) error { +// KillExisting kills existing scheduled stops +func KillExisting(profiles []string) error { return fmt.Errorf("not yet implemented for windows") } diff --git a/pkg/minikube/schedule/schedule.go b/pkg/minikube/schedule/schedule.go index 475dc6d340..b430841da8 100644 --- a/pkg/minikube/schedule/schedule.go +++ b/pkg/minikube/schedule/schedule.go @@ -17,12 +17,13 @@ limitations under the License. package schedule import ( - "log" "time" "github.com/pkg/errors" "k8s.io/minikube/pkg/minikube/config" + "k8s.io/minikube/pkg/minikube/driver" "k8s.io/minikube/pkg/minikube/mustload" + "k8s.io/minikube/pkg/minikube/out" ) // Daemonize daemonizes minikube so that scheduled stop happens as expected @@ -32,11 +33,12 @@ func Daemonize(profiles []string, duration time.Duration) error { InitiationTime: time.Now().Unix(), Duration: duration, } - if err := killExistingScheduledStops(profiles); err != nil { - log.Printf("error killing existing scheduled stops: %v", err) - } for _, p := range profiles { _, cc := mustload.Partial(p) + if driver.BareMetal(cc.Driver) { + out.WarningT("scheduled stop is not supported on the none driver, skipping scheduling") + continue + } cc.ScheduledStop = scheduledStop if err := config.SaveProfile(p, cc); err != nil { return errors.Wrap(err, "saving profile") From 635f2a71b59f8f942b6c232ad35af805f41536bc Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 9 Nov 2020 13:52:51 -0800 Subject: [PATCH 14/18] fix lint --- cmd/minikube/cmd/stop.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/stop.go b/cmd/minikube/cmd/stop.go index 44c4238efd..fb0ae8d057 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -60,7 +60,9 @@ func init() { stopCmd.Flags().BoolVar(&stopAll, "all", false, "Set flag to stop all profiles (clusters)") stopCmd.Flags().BoolVar(&keepActive, "keep-context-active", false, "keep the kube-context active after cluster is stopped. Defaults to false.") stopCmd.Flags().DurationVar(&scheduledStopDuration, "schedule", 0*time.Second, "Set flag to stop cluster after a set amount of time (e.g. --schedule=5m)") - stopCmd.Flags().MarkHidden("schedule") + if err := stopCmd.Flags().MarkHidden("schedule"); err != nil { + klog.Info("unable to mark --schedule flag as hidden") + } stopCmd.Flags().StringVarP(&outputFormat, "output", "o", "text", "Format to print stdout in. Options include: [text,json]") if err := viper.GetViper().BindPFlags(stopCmd.Flags()); err != nil { From 6c48c6092209c0e163d91b22eb1710cf15914523 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 9 Nov 2020 13:54:15 -0800 Subject: [PATCH 15/18] fix docs --- site/content/en/docs/commands/stop.md | 1 - 1 file changed, 1 deletion(-) diff --git a/site/content/en/docs/commands/stop.md b/site/content/en/docs/commands/stop.md index 0437f35eb1..9f54204ab1 100644 --- a/site/content/en/docs/commands/stop.md +++ b/site/content/en/docs/commands/stop.md @@ -23,7 +23,6 @@ minikube stop [flags] --all Set flag to stop all profiles (clusters) --keep-context-active keep the kube-context active after cluster is stopped. Defaults to false. -o, --output string Format to print stdout in. Options include: [text,json] (default "text") - --schedule duration Set flag to stop cluster after a set amount of time (e.g. --schedule=5m) ``` ### Options inherited from parent commands From bcf236f15c123687b28eabde93a5ce4083ebb3bd Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 9 Nov 2020 13:56:50 -0800 Subject: [PATCH 16/18] don't run scheduled stop test with none driver --- pkg/minikube/config/types.go | 1 + test/integration/scheduled_stop_test.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/pkg/minikube/config/types.go b/pkg/minikube/config/types.go index 25914de283..1d19604bc4 100644 --- a/pkg/minikube/config/types.go +++ b/pkg/minikube/config/types.go @@ -141,6 +141,7 @@ type VersionedExtraOption struct { } // ScheduledStopConfig contains information around scheduled stop +// not yet used, will be used to show status of scheduled stop type ScheduledStopConfig struct { InitiationTime int64 Duration time.Duration diff --git a/test/integration/scheduled_stop_test.go b/test/integration/scheduled_stop_test.go index b11bdfec6c..ba0341b942 100644 --- a/test/integration/scheduled_stop_test.go +++ b/test/integration/scheduled_stop_test.go @@ -35,6 +35,9 @@ import ( ) func TestScheduledStop(t *testing.T) { + if NoneDriver() { + t.Skip("--schedule does not apply to none driver ") + } profile := UniqueProfileName("scheduled-stop") ctx, cancel := context.WithTimeout(context.Background(), Minutes(5)) defer CleanupWithLogs(t, profile, cancel) From 930033120942416fcd811da923eb84db9ed7882c Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 9 Nov 2020 15:47:15 -0800 Subject: [PATCH 17/18] don't try to daemonize none driver --- pkg/minikube/schedule/schedule.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/minikube/schedule/schedule.go b/pkg/minikube/schedule/schedule.go index b430841da8..a016cf00bf 100644 --- a/pkg/minikube/schedule/schedule.go +++ b/pkg/minikube/schedule/schedule.go @@ -33,17 +33,19 @@ func Daemonize(profiles []string, duration time.Duration) error { InitiationTime: time.Now().Unix(), Duration: duration, } + var daemonizeProfiles []string for _, p := range profiles { _, cc := mustload.Partial(p) if driver.BareMetal(cc.Driver) { out.WarningT("scheduled stop is not supported on the none driver, skipping scheduling") continue } + daemonizeProfiles = append(daemonizeProfiles, p) cc.ScheduledStop = scheduledStop if err := config.SaveProfile(p, cc); err != nil { return errors.Wrap(err, "saving profile") } } - return daemonize(profiles, duration) + return daemonize(daemonizeProfiles, duration) } From 5569817c268e9134095fa381bdc85ceada07fd39 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 10 Nov 2020 10:58:31 -0800 Subject: [PATCH 18/18] Address code review comments --- cmd/minikube/cmd/stop.go | 5 +- pkg/minikube/schedule/daemonize_unix.go | 55 +++++++++++++--------- pkg/minikube/schedule/daemonize_windows.go | 8 ++-- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/cmd/minikube/cmd/stop.go b/cmd/minikube/cmd/stop.go index bf7bd2b7b3..a677051b66 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -17,7 +17,6 @@ limitations under the License. package cmd import ( - "log" "os" "runtime" "time" @@ -97,9 +96,7 @@ func runStop(cmd *cobra.Command, args []string) { } // Kill any existing scheduled stops - if err := schedule.KillExisting(profilesToStop); err != nil { - log.Printf("error killing existing scheduled stops: %v", err) - } + schedule.KillExisting(profilesToStop) if scheduledStopDuration != 0 { if runtime.GOOS == "windows" { diff --git a/pkg/minikube/schedule/daemonize_unix.go b/pkg/minikube/schedule/daemonize_unix.go index 4f52a7621d..022b6de8a6 100644 --- a/pkg/minikube/schedule/daemonize_unix.go +++ b/pkg/minikube/schedule/daemonize_unix.go @@ -31,30 +31,41 @@ import ( "k8s.io/minikube/pkg/minikube/localpath" ) -// KillExisting kills existing scheduled stops -func KillExisting(profiles []string) error { +// KillExisting kills existing scheduled stops by looking up the PID +// of the scheduled stop from the PID file saved for the profile and killing the process +func KillExisting(profiles []string) { for _, profile := range profiles { - file := localpath.PID(profile) - f, err := ioutil.ReadFile(file) - if os.IsNotExist(err) { - return nil + if err := killPIDForProfile(profile); err != nil { + klog.Errorf("error killng PID for profile %s: %v", profile, err) } - defer os.Remove(file) - if err != nil { - return errors.Wrapf(err, "reading %s", file) - } - pid, err := strconv.Atoi(string(f)) - if err != nil { - return errors.Wrapf(err, "converting %v to int", string(f)) - } - p, err := os.FindProcess(pid) - if err != nil { - return errors.Wrap(err, "finding process") - } - klog.Infof("killing process %v as it is an old scheduled stop", pid) - if err := p.Kill(); err != nil { - return errors.Wrapf(err, "killing %v", pid) + } +} + +func killPIDForProfile(profile string) error { + file := localpath.PID(profile) + f, err := ioutil.ReadFile(file) + if os.IsNotExist(err) { + return nil + } + defer func() { + if err := os.Remove(file); err != nil { + klog.Errorf("error deleting %s: %v, you may have to delete in manually", file, err) } + }() + if err != nil { + return errors.Wrapf(err, "reading %s", file) + } + pid, err := strconv.Atoi(string(f)) + if err != nil { + return errors.Wrapf(err, "converting %s to int", f) + } + p, err := os.FindProcess(pid) + if err != nil { + return errors.Wrap(err, "finding process") + } + klog.Infof("killing process %v as it is an old scheduled stop", pid) + if err := p.Kill(); err != nil { + return errors.Wrapf(err, "killing %v", pid) } return nil } @@ -72,7 +83,7 @@ func daemonize(profiles []string, duration time.Duration) error { func savePIDs(pid int, profiles []string) error { for _, p := range profiles { file := localpath.PID(p) - if err := ioutil.WriteFile(file, []byte(fmt.Sprintf("%v", pid)), 0644); err != nil { + if err := ioutil.WriteFile(file, []byte(fmt.Sprintf("%v", pid)), 0600); err != nil { return err } } diff --git a/pkg/minikube/schedule/daemonize_windows.go b/pkg/minikube/schedule/daemonize_windows.go index 7744c9d26f..ea3c7fa238 100644 --- a/pkg/minikube/schedule/daemonize_windows.go +++ b/pkg/minikube/schedule/daemonize_windows.go @@ -21,11 +21,13 @@ package schedule import ( "fmt" "time" + + "k8s.io/klog/v2" ) -// KillExisting kills existing scheduled stops -func KillExisting(profiles []string) error { - return fmt.Errorf("not yet implemented for windows") +// KillExisting will kill existing scheduled stops +func KillExisting(profiles []string) { + klog.Errorf("not yet implemented for windows") } func daemonize(profiles []string, duration time.Duration) error {