From a2815b2e6da4f2aba5d37883498820680338bf3c Mon Sep 17 00:00:00 2001 From: Shelley-BaoYue Date: Mon, 22 Jan 2024 21:09:38 +0800 Subject: fix keadm flag in windows Signed-off-by: Shelley-BaoYue --- keadm/cmd/keadm/app/cmd/edge/join_windows.go | 24 ++++++++++++++---------- keadm/cmd/keadm/app/cmd/reset_windows.go | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/keadm/cmd/keadm/app/cmd/edge/join_windows.go b/keadm/cmd/keadm/app/cmd/edge/join_windows.go index a17fed841..fdcff3d69 100644 --- a/keadm/cmd/keadm/app/cmd/edge/join_windows.go +++ b/keadm/cmd/keadm/app/cmd/edge/join_windows.go @@ -45,35 +45,39 @@ import ( ) func AddJoinOtherFlags(cmd *cobra.Command, joinOptions *common.JoinOptions) { - cmd.Flags().StringVar(&joinOptions.KubeEdgeVersion, common.KubeEdgeVersion, joinOptions.KubeEdgeVersion, + cmd.Flags().StringVar(&joinOptions.KubeEdgeVersion, common.FlagNameKubeEdgeVersion, joinOptions.KubeEdgeVersion, "Use this key to download and use the required KubeEdge version") - cmd.Flags().Lookup(common.KubeEdgeVersion).NoOptDefVal = joinOptions.KubeEdgeVersion + cmd.Flags().Lookup(common.FlagNameKubeEdgeVersion).NoOptDefVal = joinOptions.KubeEdgeVersion - cmd.Flags().StringVar(&joinOptions.CertPath, common.CertPath, joinOptions.CertPath, + cmd.Flags().StringVar(&joinOptions.CertPath, common.FlagNameCertPath, joinOptions.CertPath, fmt.Sprintf("The certPath used by edgecore, the default value is %s", common.DefaultCertPath)) - cmd.Flags().StringVarP(&joinOptions.CloudCoreIPPort, common.CloudCoreIPPort, "e", joinOptions.CloudCoreIPPort, + cmd.Flags().StringVarP(&joinOptions.CloudCoreIPPort, common.FlagNameCloudCoreIPPort, "e", joinOptions.CloudCoreIPPort, "IP:Port address of KubeEdge CloudCore") - if err := cmd.MarkFlagRequired(common.CloudCoreIPPort); err != nil { + if err := cmd.MarkFlagRequired(common.FlagNameCloudCoreIPPort); err != nil { fmt.Printf("mark flag required failed with error: %v\n", err) } - cmd.Flags().StringVarP(&joinOptions.EdgeNodeName, common.EdgeNodeName, "i", joinOptions.EdgeNodeName, + cmd.Flags().StringVarP(&joinOptions.EdgeNodeName, common.FlagNameEdgeNodeName, "i", joinOptions.EdgeNodeName, "KubeEdge Node unique identification string, if flag not used then the command will generate a unique id on its own") - cmd.Flags().StringVarP(&joinOptions.RemoteRuntimeEndpoint, common.RemoteRuntimeEndpoint, "p", joinOptions.RemoteRuntimeEndpoint, + cmd.Flags().StringVarP(&joinOptions.RemoteRuntimeEndpoint, common.FlagNameRemoteRuntimeEndpoint, "p", joinOptions.RemoteRuntimeEndpoint, "KubeEdge Edge Node RemoteRuntimeEndpoint string.") - cmd.Flags().StringVarP(&joinOptions.Token, common.Token, "t", joinOptions.Token, + cmd.Flags().StringVarP(&joinOptions.Token, common.FlagNameToken, "t", joinOptions.Token, "Used for edge to apply for the certificate") - cmd.Flags().StringVarP(&joinOptions.CertPort, common.CertPort, "s", joinOptions.CertPort, + cmd.Flags().StringVarP(&joinOptions.CertPort, common.FlagNameCertPort, "s", joinOptions.CertPort, "The port where to apply for the edge certificate") - cmd.Flags().StringSliceVarP(&joinOptions.Labels, common.Labels, "l", joinOptions.Labels, + cmd.Flags().StringSliceVarP(&joinOptions.Labels, common.FlagNameLabels, "l", joinOptions.Labels, `Use this key to set the customized labels for node, you can input customized labels like key1=value1,key2=value2`) + cmd.Flags().StringVar(&joinOptions.ImageRepository, common.FlagNameImageRepository, joinOptions.ImageRepository, + `Use this key to decide which image repository to pull images from`, + ) + cmd.Flags().StringVar(&joinOptions.HubProtocol, common.HubProtocol, joinOptions.HubProtocol, `Use this key to decide which communication protocol the edge node adopts.`) } diff --git a/keadm/cmd/keadm/app/cmd/reset_windows.go b/keadm/cmd/keadm/app/cmd/reset_windows.go index d8e4b5a33..722fffd19 100644 --- a/keadm/cmd/keadm/app/cmd/reset_windows.go +++ b/keadm/cmd/keadm/app/cmd/reset_windows.go @@ -191,6 +191,6 @@ func addResetFlags(cmd *cobra.Command, resetOpts *common.ResetOptions) { // "Use this key to set kube-config path, eg: $HOME/.kube/config") cmd.Flags().BoolVar(&resetOpts.Force, "force", resetOpts.Force, "Reset the node without prompting for confirmation, and continue even if running edgecore not found") - cmd.Flags().StringVar(&resetOpts.Endpoint, common.RemoteRuntimeEndpoint, resetOpts.Endpoint, + cmd.Flags().StringVar(&resetOpts.Endpoint, common.FlagNameRemoteRuntimeEndpoint, resetOpts.Endpoint, "Use this key to set container runtime endpoint") } -- cgit v1.2.3