From 41c2fab749cb836093a9d84103674c57e19429f1 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Tue, 7 Jan 2025 15:48:02 +0100 Subject: [PATCH] Narrow down kubelet-root-dir flag It's a worker flag, so it should be part of the worker flags. Since this is also needed for cleanup, add it to the reset subcommand as well. Signed-off-by: Tom Wieczorek --- cmd/reset/reset.go | 8 ++++++-- pkg/config/cli.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/reset/reset.go b/cmd/reset/reset.go index 908c1540f7c5..59dd16d1a5dd 100644 --- a/cmd/reset/reset.go +++ b/cmd/reset/reset.go @@ -46,8 +46,12 @@ func NewResetCmd() *cobra.Command { }, } cmd.PersistentFlags().AddFlagSet(config.GetPersistentFlagSet()) - cmd.Flags().AddFlagSet(config.GetCriSocketFlag()) - cmd.Flags().AddFlagSet(config.FileInputFlag()) + + flags := cmd.Flags() + flags.AddFlagSet(config.GetCriSocketFlag()) + flags.AddFlagSet(config.FileInputFlag()) + flags.String("kubelet-root-dir", "", "Kubelet root directory for k0s") + return cmd } diff --git a/pkg/config/cli.go b/pkg/config/cli.go index 3486e5edd062..a567b5a3c8ab 100644 --- a/pkg/config/cli.go +++ b/pkg/config/cli.go @@ -200,7 +200,6 @@ func GetPersistentFlagSet() *pflag.FlagSet { flagset.BoolVarP(&Debug, "debug", "d", false, "Debug logging (default: false)") flagset.BoolVarP(&Verbose, "verbose", "v", false, "Verbose logging (default: false)") flagset.String("data-dir", constant.DataDirDefault, "Data Directory for k0s. DO NOT CHANGE for an existing setup, things will break!") - flagset.String("kubelet-root-dir", "", "Kubelet root directory for k0s") flagset.StringVar(&StatusSocket, "status-socket", "", "Full file path to the socket file. (default: /status.sock)") flagset.StringVar(&DebugListenOn, "debugListenOn", ":6060", "Http listenOn for Debug pprof handler") return flagset @@ -234,6 +233,7 @@ func GetWorkerFlags() *pflag.FlagSet { workerOpts.LogLevels = DefaultLogLevels() } + flagset.String("kubelet-root-dir", "", "Kubelet root directory for k0s") flagset.StringVar(&workerOpts.WorkerProfile, "profile", "default", "worker profile to use on the node") flagset.StringVar(&workerOpts.CIDRRange, "cidr-range", "10.96.0.0/12", "HACK: cidr range for the windows worker node") flagset.BoolVar(&workerOpts.CloudProvider, "enable-cloud-provider", false, "Whether or not to enable cloud provider support in kubelet")