chore(clustertool): move some talos and flux commands so subcommands

This commit is contained in:
Kjeld Schouten
2024-11-04 15:47:14 +01:00
parent 638b21f4a5
commit 0b19284dcb
8 changed files with 59 additions and 9 deletions
+25
View File
@@ -0,0 +1,25 @@
package cmd
import (
"strings"
"github.com/spf13/cobra"
)
var fluxLongHelp = strings.TrimSpace(`
These are all commands that can be used to maintain FluxCD
`)
var fluxCmd = &cobra.Command{
Use: "flux",
Short: "Commands for handling FluxCD",
Example: "clustertool flux bootstrap",
Long: advLongHelp,
SilenceUsage: true,
SilenceErrors: true,
}
func init() {
RootCmd.AddCommand(fluxCmd)
}
@@ -16,9 +16,9 @@ var fluxBootstrapLongHelp = strings.TrimSpace(`
`)
var fluxbootstrap = &cobra.Command{
Use: "fluxbootstrap",
Use: "bootstrap",
Short: "Manually bootstrap fluxcd on existing cluster",
Example: "clustertool fluxbootstrap",
Example: "clustertool flux bootstrap",
Long: fluxBootstrapLongHelp,
Run: func(cmd *cobra.Command, args []string) {
ctx := context.Background()
@@ -32,5 +32,5 @@ var fluxbootstrap = &cobra.Command{
}
func init() {
RootCmd.AddCommand(fluxbootstrap)
fluxCmd.AddCommand(fluxbootstrap)
}
+25
View File
@@ -0,0 +1,25 @@
package cmd
import (
"strings"
"github.com/spf13/cobra"
)
var talosLongHelp = strings.TrimSpace(`
These are all commands that can be used to maintain Talos OS
`)
var talosCmd = &cobra.Command{
Use: "talos",
Short: "Commands for handling Talos OS",
Example: "clustertool talos apply",
Long: advLongHelp,
SilenceUsage: true,
SilenceErrors: true,
}
func init() {
RootCmd.AddCommand(talosCmd)
}
@@ -44,7 +44,7 @@ Not any contained helm-charts
var apply = &cobra.Command{
Use: "apply",
Short: "apply TalosConfig",
Short: "apply",
Example: "clustertool apply <NodeIP>",
Long: applyLongHelp,
Run: func(cmd *cobra.Command, args []string) {
@@ -115,5 +115,5 @@ func RunApply(kubeconfig bool, node string, extraArgs []string) {
}
func init() {
RootCmd.AddCommand(apply)
talosCmd.AddCommand(apply)
}
@@ -24,5 +24,5 @@ func bootstrapfunc(cmd *cobra.Command, args []string) {
}
func init() {
adv.AddCommand(bootstrap)
talosCmd.AddCommand(bootstrap)
}
@@ -30,5 +30,5 @@ var health = &cobra.Command{
}
func init() {
adv.AddCommand(health)
talosCmd.AddCommand(health)
}
@@ -45,5 +45,5 @@ var reset = &cobra.Command{
}
func init() {
adv.AddCommand(reset)
talosCmd.AddCommand(reset)
}
@@ -58,5 +58,5 @@ var upgrade = &cobra.Command{
}
func init() {
RootCmd.AddCommand(upgrade)
talosCmd.AddCommand(upgrade)
}