Files
kube-forge/cmd/root.go

46 lines
1.3 KiB
Go

package cmd
import (
"fmt"
"kube-forge/internal/additional"
"kube-forge/internal/config"
"kube-forge/internal/csi"
"os"
"github.com/spf13/cobra"
)
func installAndConfigureModules() {
csi.ApplyCharts()
additional.ApplyCharts()
}
func init() {
rootCmd.PersistentFlags().StringVarP(&config.ConfigFile, "config", "c", "config.yaml", "path to configuration file for cluster")
rootCmd.PersistentFlags().StringVarP(&config.Output, "output", "o", "", "directory to store k8s admin config")
rootCmd.PersistentFlags().StringVarP(&config.Password, "password", "p", "", "password to access hosts via SSH")
rootCmd.PersistentFlags().CountVarP(&config.Verbose, "verbose", "v", "enable verbose logging (use -v, -vv, -vvv for increasing levels)")
rootCmd.PersistentFlags().StringVar(&config.LogFile, "log-file", "", "path to log file for verbose output")
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
var (
rootCmd = &cobra.Command{
Use: "kube-forge <subcommand>",
Short: "Kube-forge will help you to deploy K8s clusters",
Long: `An easy to use K8s installer`,
Args: func(cmd *cobra.Command, args []string) error {
if err := cobra.MinimumNArgs(0)(cmd, args); err != nil {
return err
}
return nil
},
}
)