55 lines
1.3 KiB
Go
55 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"kube-forge/internal/additional"
|
|
"kube-forge/internal/config"
|
|
"kube-forge/internal/csi"
|
|
"kube-forge/internal/kubespray"
|
|
"kube-forge/internal/logging"
|
|
"kube-forge/internal/templates"
|
|
"os"
|
|
)
|
|
|
|
func installAndConfigureModules() {
|
|
csi.ApplyCharts()
|
|
additional.ApplyCharts()
|
|
}
|
|
|
|
func main() {
|
|
var password, configPath, workDir string
|
|
var verbose bool
|
|
|
|
flag.StringVar(&password, "p", "", "Password to access hosts")
|
|
flag.StringVar(&configPath, "c", "/etc/kube-forge/config.yaml", "Path to config file")
|
|
flag.StringVar(&workDir, "d", "/var/lib/kube-forge", "Path to kube-forge work dir")
|
|
flag.BoolVar(&verbose, "v", false, "Enable verbose logging")
|
|
flag.Parse()
|
|
config := config.CreateConfig(configPath, workDir, password)
|
|
config.Verbose = verbose
|
|
|
|
templates.ApplyK8sTemplates()
|
|
|
|
for _, cmd := range os.Args {
|
|
switch cmd {
|
|
case "apply":
|
|
kubespray.InstallCluster("")
|
|
installAndConfigureModules()
|
|
return
|
|
case "apply-modules":
|
|
installAndConfigureModules()
|
|
return
|
|
case "upgrade":
|
|
kubespray.UpgradeCluster("")
|
|
return
|
|
case "scale":
|
|
kubespray.ScaleCluster()
|
|
return
|
|
case "reset":
|
|
kubespray.ResetCluster()
|
|
return
|
|
}
|
|
}
|
|
logging.Log.Error("No such command\nAvailable commands: apply, apply-modules, upgrade, scale, reset")
|
|
}
|