[AIR-97] Adding base airshipctl cluster command

New subcommands will be added later, this commit is a simple base
for other commits related to airshipctl cluster command

Change-Id: I77057c291b88bae3b8fca08ddf56bdf6d183fd24
This commit is contained in:
Kostiantyn Kalynovskyi 2019-09-30 16:13:04 -05:00
parent 08cc716de5
commit c58862e17e
5 changed files with 52 additions and 0 deletions

24
cmd/cluster/cluster.go Normal file
View File

@ -0,0 +1,24 @@
package cluster
import (
"github.com/spf13/cobra"
"opendev.org/airship/airshipctl/pkg/environment"
)
var (
// ClusterUse subcommand string
ClusterUse = "cluster"
)
// NewClusterCommand returns cobra command object of the airshipctl cluster and adds it's subcommands.
func NewClusterCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Command {
clusterRootCmd := &cobra.Command{
Use: ClusterUse,
// TODO: (kkalynovskyi) Add more description when more subcommands are added
Short: "Control kubernetes cluster",
Long: "Interactions with kubernetes cluster, such as get status, deploy initial infrastructure",
}
return clusterRootCmd
}

View File

@ -0,0 +1,21 @@
package cluster_test
import (
"testing"
"opendev.org/airship/airshipctl/cmd/cluster"
"opendev.org/airship/airshipctl/testutil"
)
func TestNewClusterCommandReturn(t *testing.T) {
tests := []*testutil.CmdTest{
{
Name: "cluster-cmd-with-defaults",
CmdLine: "",
Cmd: cluster.NewClusterCommand(nil),
},
}
for _, testcase := range tests {
testutil.RunTest(t, testcase)
}
}

View File

@ -0,0 +1,2 @@
Interactions with kubernetes cluster, such as get status, deploy initial infrastructure

View File

@ -13,6 +13,7 @@ import (
_ "k8s.io/client-go/plugin/pkg/client/auth"
"opendev.org/airship/airshipctl/cmd/bootstrap"
"opendev.org/airship/airshipctl/cmd/cluster"
"opendev.org/airship/airshipctl/cmd/completion"
"opendev.org/airship/airshipctl/cmd/document"
"opendev.org/airship/airshipctl/pkg/environment"
@ -51,6 +52,7 @@ func NewRootCmd(out io.Writer) (*cobra.Command, *environment.AirshipCTLSettings,
func AddDefaultAirshipCTLCommands(cmd *cobra.Command, settings *environment.AirshipCTLSettings) *cobra.Command {
cmd.AddCommand(argo.NewCommand())
cmd.AddCommand(bootstrap.NewBootstrapCommand(settings))
cmd.AddCommand(cluster.NewClusterCommand(settings))
cmd.AddCommand(completion.NewCompletionCommand())
cmd.AddCommand(document.NewDocumentCommand(settings))
cmd.AddCommand(kubectl.NewDefaultKubectlCommand())

View File

@ -17,4 +17,7 @@ Flags:
--debug enable verbose output
-h, --help help for airshipctl
Additional help topics:
airshipctl cluster Control kubernetes cluster
Use "airshipctl [command] --help" for more information about a command.