add ability to log to file, update to v2.28.1 and fix 'first upgrade' issue

This commit is contained in:
2025-09-13 00:49:05 +03:00
parent d51a98efb3
commit 4f38f3a851
35 changed files with 773 additions and 543 deletions

View File

@@ -13,7 +13,8 @@ var (
ConfigFile string
Output string
Password string
Verbose bool
Verbose int
LogFile string
)
type Host struct {
@@ -27,7 +28,8 @@ type Host struct {
type Config struct {
BaseDir string
InventoryDir string
Verbose bool
Verbose int
LogFile string
KubeconfigFile string
Forks string `yaml:"forks" env-default:"10"`
InstallationName string `yaml:"installation_name" env-default:"cluster.local"`
@@ -52,7 +54,7 @@ type Config struct {
var instance *Config
func createConfig(configFile string, out string, password string, verbose bool) *Config {
func createConfig(configFile string, out string, password string, verbose int, logFile string) *Config {
instance = &Config{}
if err := cleanenv.ReadConfig(configFile, instance); err != nil {
@@ -77,17 +79,21 @@ func createConfig(configFile string, out string, password string, verbose bool)
}
instance.Verbose = verbose
instance.LogFile = logFile
err := validateConfig(*instance)
if err != nil {
logging.Log.Fatal(err.Error())
}
logging.SetupLogging(instance.Verbose, instance.LogFile)
return instance
}
func GetConfig() *Config {
if instance == nil {
createConfig(ConfigFile, Output, Password, Verbose)
createConfig(ConfigFile, Output, Password, Verbose, LogFile)
}
return instance
}

View File

@@ -42,14 +42,15 @@ type Additional struct {
} `yaml:"load_balancer"`
DockerSecrets struct {
ChartRef string `yaml:"chart_ref" env-default:"kube-forge/docker-secrets-generator"`
ChartVersion string `yaml:"chart_version" env-default:"0.1.0"`
Namespace string `yaml:"namespace" env-default:"kube-system"`
Repositories interface{} `yaml:"repositories"`
ChartRef string `yaml:"chart_ref" env-default:"kube-forge/docker-secrets-generator"`
ChartVersion string `yaml:"chart_version" env-default:"0.1.0"`
Namespace string `yaml:"namespace" env-default:"kube-system"`
Repositories any `yaml:"repositories"`
} `yaml:"docker_secrets"`
Storage struct {
LocalPathProvisioner struct {
Enabled bool `yaml:"enabled"`
StorageClassName string `yaml:"storage_class_name" env-default:"local-path"`
ReclaimPolicy string `yaml:"reclaim_policy" env-default:"Delete"`
DataDir string `yaml:"data_dir" env-default:"/opt/local-path-provisioner/"`

View File

@@ -5,6 +5,9 @@ import (
)
var kubernetesVersions = []string{
"1.32.8",
"1.32.7",
"1.32.6",
"1.32.5",
"1.32.4",
"1.32.3",