From f24230481f34cc85bc6351250730465d930ba71d Mon Sep 17 00:00:00 2001 From: darshanime Date: Thu, 21 Feb 2019 23:35:23 +0530 Subject: [PATCH] unhide cobra commands Signed-off-by: darshanime --- cmd/rook/cassandra/cassandra.go | 8 +++--- cmd/rook/ceph/agent.go | 5 ++-- cmd/rook/ceph/ceph.go | 23 +++++++---------- cmd/rook/ceph/config.go | 5 ++-- cmd/rook/ceph/mds.go | 5 ++-- cmd/rook/ceph/nfs.go | 18 +++++-------- cmd/rook/ceph/operator.go | 3 +-- cmd/rook/ceph/osd.go | 40 ++++++++++++----------------- cmd/rook/ceph/rgw.go | 5 ++-- cmd/rook/cockroachdb/cockroachdb.go | 2 +- cmd/rook/discover.go | 5 ++-- cmd/rook/edgefs/edgefs.go | 2 +- cmd/rook/main.go | 21 +++++++-------- cmd/rook/minio/minio.go | 5 ++-- cmd/rook/nfs/nfs.go | 5 ++-- cmd/rook/rook/rook.go | 3 +-- 16 files changed, 63 insertions(+), 92 deletions(-) diff --git a/cmd/rook/cassandra/cassandra.go b/cmd/rook/cassandra/cassandra.go index 8d9420e17..f66b28630 100644 --- a/cmd/rook/cassandra/cassandra.go +++ b/cmd/rook/cassandra/cassandra.go @@ -27,9 +27,8 @@ import ( // Cmd exports cobra command according to the cobra documentation. var Cmd = &cobra.Command{ - Use: "cassandra", - Short: "Main command for cassandra controller pod.", - Hidden: true, + Use: "cassandra", + Short: "Main command for cassandra controller pod.", } var ( @@ -37,8 +36,7 @@ var ( ) func init() { - Cmd.AddCommand(operatorCmd) - Cmd.AddCommand(sidecarCmd) + Cmd.AddCommand(operatorCmd, sidecarCmd) } func createContext() *clusterd.Context { diff --git a/cmd/rook/ceph/agent.go b/cmd/rook/ceph/agent.go index 45fdf3dfd..a83b0e69e 100644 --- a/cmd/rook/ceph/agent.go +++ b/cmd/rook/ceph/agent.go @@ -29,9 +29,8 @@ import ( ) var agentCmd = &cobra.Command{ - Use: "agent", - Short: "Runs the rook ceph agent", - Hidden: true, + Use: "agent", + Short: "Runs the rook ceph agent", } func init() { diff --git a/cmd/rook/ceph/ceph.go b/cmd/rook/ceph/ceph.go index f40d389fa..402969da4 100644 --- a/cmd/rook/ceph/ceph.go +++ b/cmd/rook/ceph/ceph.go @@ -30,9 +30,8 @@ import ( // Cmd is the main command for operator and daemons. var Cmd = &cobra.Command{ - Use: "ceph", - Short: "Main command for Ceph operator and daemons.", - Hidden: true, + Use: "ceph", + Short: "Main command for Ceph operator and daemons.", } var ( @@ -56,17 +55,13 @@ type config struct { } func init() { - AddCommands(Cmd) -} - -func AddCommands(command *cobra.Command) { - command.AddCommand(operatorCmd) - command.AddCommand(agentCmd) - command.AddCommand(osdCmd) - command.AddCommand(rgwCmd) - command.AddCommand(mdsCmd) - command.AddCommand(configCmd) - command.AddCommand(nfsCmd) + Cmd.AddCommand(operatorCmd, + agentCmd, + osdCmd, + rgwCmd, + mdsCmd, + configCmd, + nfsCmd) } func createContext() *clusterd.Context { diff --git a/cmd/rook/ceph/config.go b/cmd/rook/ceph/config.go index 8bb0cba15..d39d491a5 100644 --- a/cmd/rook/ceph/config.go +++ b/cmd/rook/ceph/config.go @@ -35,9 +35,8 @@ key = %s ) var configCmd = &cobra.Command{ - Use: "config-init", - Short: "Generates basic ceph config", - Hidden: true, + Use: "config-init", + Short: "Generates basic ceph config", } var ( diff --git a/cmd/rook/ceph/mds.go b/cmd/rook/ceph/mds.go index 81421bd0d..dd57d2a6c 100644 --- a/cmd/rook/ceph/mds.go +++ b/cmd/rook/ceph/mds.go @@ -32,9 +32,8 @@ var ( ) var mdsCmd = &cobra.Command{ - Use: mdsdaemon.InitCommand, - Short: "Generates mds config and runs the mds daemon", - Hidden: true, + Use: mdsdaemon.InitCommand, + Short: "Generates mds config and runs the mds daemon", } func init() { diff --git a/cmd/rook/ceph/nfs.go b/cmd/rook/ceph/nfs.go index 348db8bf1..7b16f2a6d 100644 --- a/cmd/rook/ceph/nfs.go +++ b/cmd/rook/ceph/nfs.go @@ -30,19 +30,16 @@ var ( ) var nfsCmd = &cobra.Command{ - Use: "nfs", - Short: "Configures and runs the ceph nfs daemon", - Hidden: true, + Use: "nfs", + Short: "Configures and runs the ceph nfs daemon", } var ganeshaConfigCmd = &cobra.Command{ - Use: "init", - Short: "Updates ceph.conf for nfs", - Hidden: true, + Use: "init", + Short: "Updates ceph.conf for nfs", } var ganeshaRunCmd = &cobra.Command{ - Use: "run", - Short: "Runs the ceph nfs daemon", - Hidden: true, + Use: "run", + Short: "Runs the ceph nfs daemon", } func init() { @@ -50,8 +47,7 @@ func init() { ganeshaConfigCmd.Flags().StringVar(&ganeshaCopyBinariesPath, "copy-binaries-path", "", "If specified, copy the rook binaries to this path for use by the daemon container") addCephFlags(ganeshaConfigCmd) - nfsCmd.AddCommand(ganeshaConfigCmd) - nfsCmd.AddCommand(ganeshaRunCmd) + nfsCmd.AddCommand(ganeshaConfigCmd, ganeshaRunCmd) flags.SetFlagsFromEnv(nfsCmd.Flags(), rook.RookEnvVarPrefix) flags.SetFlagsFromEnv(ganeshaConfigCmd.Flags(), rook.RookEnvVarPrefix) diff --git a/cmd/rook/ceph/operator.go b/cmd/rook/ceph/operator.go index 0a3dc2726..1dd270b70 100644 --- a/cmd/rook/ceph/operator.go +++ b/cmd/rook/ceph/operator.go @@ -22,7 +22,7 @@ import ( "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/clusterd" "github.com/rook/rook/pkg/daemon/ceph/agent/flexvolume/attachment" - "github.com/rook/rook/pkg/operator/ceph" + operator "github.com/rook/rook/pkg/operator/ceph" "github.com/rook/rook/pkg/operator/ceph/cluster/mon" "github.com/rook/rook/pkg/operator/ceph/csi" "github.com/rook/rook/pkg/operator/k8sutil" @@ -37,7 +37,6 @@ var operatorCmd = &cobra.Command{ Short: "Runs the Ceph operator for orchestrating and managing Ceph storage in a Kubernetes cluster", Long: `Runs the Ceph operator for orchestrating and managing Ceph storage in a Kubernetes cluster https://github.com/rook/rook`, - Hidden: true, } func init() { diff --git a/cmd/rook/ceph/osd.go b/cmd/rook/ceph/osd.go index 98b63b3d7..5cbb8ae0e 100644 --- a/cmd/rook/ceph/osd.go +++ b/cmd/rook/ceph/osd.go @@ -36,34 +36,28 @@ import ( ) var osdCmd = &cobra.Command{ - Use: "osd", - Short: "Provisions and runs the osd daemon", - Hidden: true, + Use: "osd", + Short: "Provisions and runs the osd daemon", } var osdConfigCmd = &cobra.Command{ - Use: "init", - Short: "Updates ceph.conf for the osd", - Hidden: true, + Use: "init", + Short: "Updates ceph.conf for the osd", } var copyBinariesCmd = &cobra.Command{ - Use: "copybins", - Short: "Copies rook binaries for use by a ceph container", - Hidden: true, + Use: "copybins", + Short: "Copies rook binaries for use by a ceph container", } var provisionCmd = &cobra.Command{ - Use: "provision", - Short: "Generates osd config and prepares an osd for runtime", - Hidden: true, + Use: "provision", + Short: "Generates osd config and prepares an osd for runtime", } var filestoreDeviceCmd = &cobra.Command{ - Use: "filestore-device", - Short: "Runs the ceph daemon for a filestore device", - Hidden: true, + Use: "filestore-device", + Short: "Runs the ceph daemon for a filestore device", } var osdStartCmd = &cobra.Command{ - Use: "start", - Short: "Starts the osd daemon", // OSDs that were provisioned by ceph-volume - Hidden: true, + Use: "start", + Short: "Starts the osd daemon", // OSDs that were provisioned by ceph-volume } var ( osdDataDeviceFilter string @@ -107,11 +101,11 @@ func addOSDFlags(command *cobra.Command) { osdStartCmd.Flags().StringVar(&osdStoreType, "osd-store-type", "", "whether the osd is bluestore or filestore") // add the subcommands to the parent osd command - osdCmd.AddCommand(osdConfigCmd) - osdCmd.AddCommand(copyBinariesCmd) - osdCmd.AddCommand(provisionCmd) - osdCmd.AddCommand(filestoreDeviceCmd) - osdCmd.AddCommand(osdStartCmd) + osdCmd.AddCommand(osdConfigCmd, + copyBinariesCmd, + provisionCmd, + filestoreDeviceCmd, + osdStartCmd) } func addOSDConfigFlags(command *cobra.Command) { diff --git a/cmd/rook/ceph/rgw.go b/cmd/rook/ceph/rgw.go index 6d83d8c5d..871a73578 100644 --- a/cmd/rook/ceph/rgw.go +++ b/cmd/rook/ceph/rgw.go @@ -28,9 +28,8 @@ import ( ) var rgwCmd = &cobra.Command{ - Use: "rgw", - Short: "Generates rgw config and runs the rgw daemon", - Hidden: true, + Use: "rgw", + Short: "Generates rgw config and runs the rgw daemon", } var ( diff --git a/cmd/rook/cockroachdb/cockroachdb.go b/cmd/rook/cockroachdb/cockroachdb.go index 38e60f308..39d28d670 100644 --- a/cmd/rook/cockroachdb/cockroachdb.go +++ b/cmd/rook/cockroachdb/cockroachdb.go @@ -28,7 +28,7 @@ import ( var Cmd = &cobra.Command{ Use: "cockroachdb", Short: "Main command for cockroachdb operator and daemons.", - Hidden: true, + Hidden: false, } var ( diff --git a/cmd/rook/discover.go b/cmd/rook/discover.go index bf9f8e765..fb32a297e 100644 --- a/cmd/rook/discover.go +++ b/cmd/rook/discover.go @@ -30,9 +30,8 @@ import ( var ( discoverCmd = &cobra.Command{ - Use: "discover", - Short: "Discover devices", - Hidden: true, + Use: "discover", + Short: "Discover devices", } // interval between discovering devices diff --git a/cmd/rook/edgefs/edgefs.go b/cmd/rook/edgefs/edgefs.go index 920698a61..2f2f51fca 100644 --- a/cmd/rook/edgefs/edgefs.go +++ b/cmd/rook/edgefs/edgefs.go @@ -28,7 +28,7 @@ import ( var Cmd = &cobra.Command{ Use: "edgefs", Short: "Main command for edgefs operator and daemons.", - Hidden: true, + Hidden: false, } var ( diff --git a/cmd/rook/main.go b/cmd/rook/main.go index 6ace76c1b..4dce9ed79 100644 --- a/cmd/rook/main.go +++ b/cmd/rook/main.go @@ -36,16 +36,13 @@ func main() { } func addCommands() { - rook.RootCmd.AddCommand(version.VersionCmd) - rook.RootCmd.AddCommand(discoverCmd) - rook.RootCmd.AddCommand(ceph.Cmd) - rook.RootCmd.AddCommand(cockroachdb.Cmd) - rook.RootCmd.AddCommand(minio.Cmd) - rook.RootCmd.AddCommand(edgefs.Cmd) - rook.RootCmd.AddCommand(nfs.Cmd) - rook.RootCmd.AddCommand(cassandra.Cmd) - - // add the ceph legacy commands to the main command for backwards compatibility - // TODO: remove these Ceph legacy commands in the future - ceph.AddCommands(rook.RootCmd) + rook.RootCmd.AddCommand( + version.VersionCmd, + discoverCmd, + ceph.Cmd, + cockroachdb.Cmd, + minio.Cmd, + edgefs.Cmd, + nfs.Cmd, + cassandra.Cmd) } diff --git a/cmd/rook/minio/minio.go b/cmd/rook/minio/minio.go index eab4b8fe1..343a1980c 100644 --- a/cmd/rook/minio/minio.go +++ b/cmd/rook/minio/minio.go @@ -26,9 +26,8 @@ import ( ) var Cmd = &cobra.Command{ - Use: "minio", - Short: "Main command for Minio operator and daemons.", - Hidden: true, + Use: "minio", + Short: "Main command for Minio operator and daemons.", } var ( diff --git a/cmd/rook/nfs/nfs.go b/cmd/rook/nfs/nfs.go index dd1d2143f..cbd21276d 100644 --- a/cmd/rook/nfs/nfs.go +++ b/cmd/rook/nfs/nfs.go @@ -26,9 +26,8 @@ import ( ) var Cmd = &cobra.Command{ - Use: "nfs", - Short: "Main command for NFS operator and daemons.", - Hidden: true, + Use: "nfs", + Short: "Main command for NFS operator and daemons.", } var ( diff --git a/cmd/rook/rook/rook.go b/cmd/rook/rook/rook.go index 7805d5324..913bef728 100644 --- a/cmd/rook/rook/rook.go +++ b/cmd/rook/rook/rook.go @@ -39,8 +39,7 @@ const ( ) var RootCmd = &cobra.Command{ - Use: "rook", - Hidden: true, + Use: "rook", } var (