add version sub command

Signed-off-by: Jeff <zw0948@gmail.com>
This commit is contained in:
Jeff
2021-04-05 15:44:27 +00:00
parent 066dfe7066
commit d98c4e8311
2 changed files with 21 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ import (
apiserverconfig "kubesphere.io/kubesphere/pkg/apiserver/config"
"kubesphere.io/kubesphere/pkg/utils/signals"
"kubesphere.io/kubesphere/pkg/utils/term"
"kubesphere.io/kubesphere/pkg/version"
tracing "kubesphere.io/kubesphere/pkg/kapis/servicemesh/metrics/v1alpha2"
)
@@ -73,6 +74,17 @@ cluster's shared state through which all other components interact.`,
fmt.Fprintf(cmd.OutOrStdout(), "%s\n\n"+usageFmt, cmd.Long, cmd.UseLine())
cliflag.PrintSections(cmd.OutOrStdout(), namedFlagSets, cols)
})
versionCmd := &cobra.Command{
Use: "version",
Short: "Print the version of KubeSphere ks-apiserver",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version.Get())
},
}
cmd.AddCommand(versionCmd)
return cmd
}