Skip to content

Commit

Permalink
Merge pull request rook#2698 from darshanime/unhide_cobra
Browse files Browse the repository at this point in the history
unhide cobra commands
  • Loading branch information
travisn authored Feb 22, 2019
2 parents 8708c5c + f242304 commit eea375e
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 92 deletions.
8 changes: 3 additions & 5 deletions cmd/rook/cassandra/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ 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 (
logger = capnslog.NewPackageLogger("github.com/rook/rook", "cassandracmd")
)

func init() {
Cmd.AddCommand(operatorCmd)
Cmd.AddCommand(sidecarCmd)
Cmd.AddCommand(operatorCmd, sidecarCmd)
}

func createContext() *clusterd.Context {
Expand Down
5 changes: 2 additions & 3 deletions cmd/rook/ceph/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
23 changes: 9 additions & 14 deletions cmd/rook/ceph/ceph.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions cmd/rook/ceph/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
5 changes: 2 additions & 3 deletions cmd/rook/ceph/mds.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
18 changes: 7 additions & 11 deletions cmd/rook/ceph/nfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,24 @@ 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() {
ganeshaRunCmd.Flags().StringVar(&ganeshaName, "ceph-nfs-name", "", "name of the nfs server")
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)
Expand Down
3 changes: 1 addition & 2 deletions cmd/rook/ceph/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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() {
Expand Down
40 changes: 17 additions & 23 deletions cmd/rook/ceph/osd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions cmd/rook/ceph/rgw.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion cmd/rook/cockroachdb/cockroachdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
var Cmd = &cobra.Command{
Use: "cockroachdb",
Short: "Main command for cockroachdb operator and daemons.",
Hidden: true,
Hidden: false,
}

var (
Expand Down
5 changes: 2 additions & 3 deletions cmd/rook/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/rook/edgefs/edgefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
var Cmd = &cobra.Command{
Use: "edgefs",
Short: "Main command for edgefs operator and daemons.",
Hidden: true,
Hidden: false,
}

var (
Expand Down
21 changes: 9 additions & 12 deletions cmd/rook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
5 changes: 2 additions & 3 deletions cmd/rook/minio/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
5 changes: 2 additions & 3 deletions cmd/rook/nfs/nfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
3 changes: 1 addition & 2 deletions cmd/rook/rook/rook.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ const (
)

var RootCmd = &cobra.Command{
Use: "rook",
Hidden: true,
Use: "rook",
}

var (
Expand Down

0 comments on commit eea375e

Please sign in to comment.