diff --git a/cmd/clusterctl/cmd/config.go b/cmd/clusterctl/cmd/config.go index dee68e6..5d3c874 100644 --- a/cmd/clusterctl/cmd/config.go +++ b/cmd/clusterctl/cmd/config.go @@ -1,6 +1,23 @@ /* -Copyright © 2024 NAME HERE +Copyright © 2024 Matthew Stobbs +Copyright © 2024 Matthew Stobbs +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// reloadCmd represents the reload command +var reloadCmd = &cobra.Command{ + Use: "reload", + Short: "Reload the clustvirt daemon configuration", + Long: `Sends SIGUSR1 to the clustvirt daemon process, indicating the server should reload it's configuration`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("reload called") + }, +} + +func init() { + daemonCmd.AddCommand(reloadCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // reloadCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // reloadCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/cmd/clusterctl/cmd/restart.go b/cmd/clusterctl/cmd/restart.go new file mode 100644 index 0000000..e015733 --- /dev/null +++ b/cmd/clusterctl/cmd/restart.go @@ -0,0 +1,35 @@ +/* +Copyright © 2024 NAME HERE +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// restartCmd represents the restart command +var restartCmd = &cobra.Command{ + Use: "restart", + Short: "Restart the clustvirt daemon process", + Long: `Some configuration requires the daemon to restart itself. + This command sends the SIGUSR2 signal, telling the daemon to restart`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("restart called") + }, +} + +func init() { + daemonCmd.AddCommand(restartCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // restartCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // restartCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/cmd/clusterctl/cmd/start.go b/cmd/clusterctl/cmd/start.go new file mode 100644 index 0000000..c3c0cc5 --- /dev/null +++ b/cmd/clusterctl/cmd/start.go @@ -0,0 +1,35 @@ +/* +Copyright © 2024 NAME HERE +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// startCmd represents the start command +var startCmd = &cobra.Command{ + Use: "start", + Short: "Start the clustvirt daemon", + Long: `Starts the clustvirt daemon loading configuration from files, + ENV variables, and command line flags in that order.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("start called") + }, +} + +func init() { + daemonCmd.AddCommand(startCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // startCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // startCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/cmd/clusterctl/cmd/stop.go b/cmd/clusterctl/cmd/stop.go new file mode 100644 index 0000000..21a92ff --- /dev/null +++ b/cmd/clusterctl/cmd/stop.go @@ -0,0 +1,36 @@ +/* +Copyright © 2024 NAME HERE +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// stopCmd represents the stop command +var stopCmd = &cobra.Command{ + Use: "stop", + Short: "Stop the clustvirt daemon", + Long: `Stop the clustvirt daemon, waiting for all processes to exit cleanly. + Triggers the SIGTERM signal to the daemon process. Can be configured + to send a SIGKILL after a timeout to forcibly terminate the process.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("stop called") + }, +} + +func init() { + daemonCmd.AddCommand(stopCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // stopCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // stopCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +}