From b061291724ccdfc4c7f54798f4e3bd93fdf68c1c Mon Sep 17 00:00:00 2001 From: Kimmo Lehto Date: Fri, 10 May 2024 10:22:38 +0300 Subject: [PATCH] Add a hidden ignored --disable-upgrade-check flag (#708) Signed-off-by: Kimmo Lehto --- cmd/apply.go | 1 + cmd/flags.go | 17 +++++++++++++---- cmd/reset.go | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cmd/apply.go b/cmd/apply.go index 0ca535f4..a46b96e5 100644 --- a/cmd/apply.go +++ b/cmd/apply.go @@ -55,6 +55,7 @@ var applyCommand = &cli.Command{ redactFlag, retryIntervalFlag, retryTimeoutFlag, + ignoredUpgradeCheckFlag, analyticsFlag, }, Before: actions(initLogging, initConfig, initManager, displayLogo, initAnalytics, displayCopyright, warnOldCache), diff --git a/cmd/flags.go b/cmd/flags.go index eb6a4fb1..7e6020c3 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -27,9 +27,11 @@ import ( "gopkg.in/yaml.v2" ) -type ctxConfigKey struct{} -type ctxManagerKey struct{} -type ctxLogFileKey struct{} +type ( + ctxConfigKey struct{} + ctxManagerKey struct{} + ctxLogFileKey struct{} +) var ( debugFlag = &cli.BoolFlag{ @@ -72,6 +74,13 @@ var ( EnvVars: []string{"DISABLE_TELEMETRY"}, } + ignoredUpgradeCheckFlag = &cli.BoolFlag{ + Name: "disable-upgrade-check", + Usage: "Do not check for a k0sctl upgrade", + EnvVars: []string{"DISABLE_UPGRADE_CHECK"}, + Hidden: true, + } + concurrencyFlag = &cli.IntFlag{ Name: "concurrency", Usage: "Maximum number of hosts to configure in parallel, set to 0 for unlimited", @@ -288,7 +297,7 @@ func LogFile() (*os.File, error) { } } - logFile, err := os.OpenFile(fn, os.O_RDWR|os.O_CREATE|os.O_APPEND|os.O_SYNC, 0600) + logFile, err := os.OpenFile(fn, os.O_RDWR|os.O_CREATE|os.O_APPEND|os.O_SYNC, 0o600) if err != nil { return nil, fmt.Errorf("Failed to open log %s: %s", fn, err.Error()) } diff --git a/cmd/reset.go b/cmd/reset.go index 1bb460ed..2110365e 100644 --- a/cmd/reset.go +++ b/cmd/reset.go @@ -21,6 +21,7 @@ var resetCommand = &cli.Command{ redactFlag, retryIntervalFlag, retryTimeoutFlag, + ignoredUpgradeCheckFlag, analyticsFlag, &cli.BoolFlag{ Name: "force",