Skip to content

Commit

Permalink
fix keadm flag in windows
Browse files Browse the repository at this point in the history
Signed-off-by: Shelley-BaoYue <[email protected]>
  • Loading branch information
Shelley-BaoYue committed Jan 22, 2024
1 parent 45f8857 commit 8eeb379
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
24 changes: 14 additions & 10 deletions keadm/cmd/keadm/app/cmd/edge/join_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.`)
}
Expand Down
2 changes: 1 addition & 1 deletion keadm/cmd/keadm/app/cmd/reset_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 8eeb379

Please sign in to comment.