[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:
parent
08cc716de5
commit
c58862e17e
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"
|
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||||
|
|
||||||
"opendev.org/airship/airshipctl/cmd/bootstrap"
|
"opendev.org/airship/airshipctl/cmd/bootstrap"
|
||||||
|
"opendev.org/airship/airshipctl/cmd/cluster"
|
||||||
"opendev.org/airship/airshipctl/cmd/completion"
|
"opendev.org/airship/airshipctl/cmd/completion"
|
||||||
"opendev.org/airship/airshipctl/cmd/document"
|
"opendev.org/airship/airshipctl/cmd/document"
|
||||||
"opendev.org/airship/airshipctl/pkg/environment"
|
"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 {
|
func AddDefaultAirshipCTLCommands(cmd *cobra.Command, settings *environment.AirshipCTLSettings) *cobra.Command {
|
||||||
cmd.AddCommand(argo.NewCommand())
|
cmd.AddCommand(argo.NewCommand())
|
||||||
cmd.AddCommand(bootstrap.NewBootstrapCommand(settings))
|
cmd.AddCommand(bootstrap.NewBootstrapCommand(settings))
|
||||||
|
cmd.AddCommand(cluster.NewClusterCommand(settings))
|
||||||
cmd.AddCommand(completion.NewCompletionCommand())
|
cmd.AddCommand(completion.NewCompletionCommand())
|
||||||
cmd.AddCommand(document.NewDocumentCommand(settings))
|
cmd.AddCommand(document.NewDocumentCommand(settings))
|
||||||
cmd.AddCommand(kubectl.NewDefaultKubectlCommand())
|
cmd.AddCommand(kubectl.NewDefaultKubectlCommand())
|
||||||
|
@ -17,4 +17,7 @@ Flags:
|
|||||||
--debug enable verbose output
|
--debug enable verbose output
|
||||||
-h, --help help for airshipctl
|
-h, --help help for airshipctl
|
||||||
|
|
||||||
|
Additional help topics:
|
||||||
|
airshipctl cluster Control kubernetes cluster
|
||||||
|
|
||||||
Use "airshipctl [command] --help" for more information about a command.
|
Use "airshipctl [command] --help" for more information about a command.
|
||||||
|
Loading…
Reference in New Issue
Block a user