diff --git a/clusterctl/cmd/create.go b/clusterctl/cmd/create.go index 0fd3143d3715..2eaa1e7e2817 100644 --- a/clusterctl/cmd/create.go +++ b/clusterctl/cmd/create.go @@ -27,5 +27,5 @@ var createCmd = &cobra.Command{ } func init() { - createCmd.AddCommand(createClusterCmd) + RootCmd.AddCommand(createCmd) } diff --git a/clusterctl/cmd/create_cluster.go b/clusterctl/cmd/create_cluster.go index 176b297d4d91..09aa12264bbf 100644 --- a/clusterctl/cmd/create_cluster.go +++ b/clusterctl/cmd/create_cluster.go @@ -77,6 +77,7 @@ func init() { // Optional flags createClusterCmd.Flags().BoolVarP(&co.CleanupExternalCluster, "cleanup-external-cluster", "", true, "Whether to cleanup the external cluster after bootstrap") createClusterCmd.Flags().StringVarP(&co.VmDriver, "vm-driver", "", "", "Which vm driver to use for minikube") + createCmd.AddCommand(createClusterCmd) } func parseClusterYaml(file string) (*clusterv1.Cluster, error) { diff --git a/clusterctl/cmd/delete.go b/clusterctl/cmd/delete.go index 690593ef057f..ca49d8e1a704 100644 --- a/clusterctl/cmd/delete.go +++ b/clusterctl/cmd/delete.go @@ -27,6 +27,5 @@ var deleteCmd = &cobra.Command{ } func init() { - deleteCmd.AddCommand(NewCmdDeleteCluster()) RootCmd.AddCommand(deleteCmd) } diff --git a/clusterctl/cmd/delete_cluster.go b/clusterctl/cmd/delete_cluster.go index b38fa4c9f2b6..76177ba067c4 100644 --- a/clusterctl/cmd/delete_cluster.go +++ b/clusterctl/cmd/delete_cluster.go @@ -46,6 +46,10 @@ func NewCmdDeleteCluster() *cobra.Command { return cmd } +func init() { + deleteCmd.AddCommand(NewCmdDeleteCluster()) +} + func RunDelete() error { return errors.NotImplementedError } diff --git a/clusterctl/cmd/root.go b/clusterctl/cmd/root.go index feb903e1b613..b6a20e0f3a0e 100644 --- a/clusterctl/cmd/root.go +++ b/clusterctl/cmd/root.go @@ -54,5 +54,4 @@ func init() { pflag.CommandLine.AddGoFlagSet(flag.CommandLine) logs.InitLogs() - RootCmd.AddCommand(createCmd) }