kube-forge v2: embede python with ansible (kubespray) and cobra as cli building tool
This commit is contained in:
@@ -1,54 +1,9 @@
|
||||
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"
|
||||
"kube-forge/cmd"
|
||||
)
|
||||
|
||||
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")
|
||||
cmd.Execute()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user