Merge "[AIR-97] Adding base airshipctl cluster command"
This commit is contained in:
commit
9503619755
24
cmd/cluster/cluster.go
Normal file
24
cmd/cluster/cluster.go
Normal 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
|
||||
}
|
21
cmd/cluster/cluster_test.go
Normal file
21
cmd/cluster/cluster_test.go
Normal 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)
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
Interactions with kubernetes cluster, such as get status, deploy initial infrastructure
|
||||
|
@ -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())
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user