fix(clustertool): dont needlessly try to configure kubeconfig
This commit is contained in:
@@ -81,7 +81,7 @@ var apply = &cobra.Command{
|
|||||||
if helper.GetYesOrNo("Do you want to bootstrap now? (yes/no) [y/n]: ") {
|
if helper.GetYesOrNo("Do you want to bootstrap now? (yes/no) [y/n]: ") {
|
||||||
gencmd.RunBootstrap(extraArgs)
|
gencmd.RunBootstrap(extraArgs)
|
||||||
if helper.GetYesOrNo("Do you want to apply config to all remaining clusternodes as well? (yes/no) [y/n]: ") {
|
if helper.GetYesOrNo("Do you want to apply config to all remaining clusternodes as well? (yes/no) [y/n]: ") {
|
||||||
RunApply("", extraArgs)
|
RunApply(false, "", extraArgs)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Info().Msg("Exiting bootstrap, as apply is not possible...")
|
log.Info().Msg("Exiting bootstrap, as apply is not possible...")
|
||||||
@@ -90,26 +90,28 @@ var apply = &cobra.Command{
|
|||||||
} else {
|
} else {
|
||||||
log.Info().Msg("Detected maintenance mode, but first node does not require to be bootrapped.")
|
log.Info().Msg("Detected maintenance mode, but first node does not require to be bootrapped.")
|
||||||
log.Info().Msg("Assuming apply is requested... continuing with Apply...")
|
log.Info().Msg("Assuming apply is requested... continuing with Apply...")
|
||||||
RunApply(node, extraArgs)
|
RunApply(true, node, extraArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if status == "running" {
|
} else if status == "running" {
|
||||||
log.Info().Msg("Apply: running first controlnode detected, continuing...")
|
log.Info().Msg("Apply: running first controlnode detected, continuing...")
|
||||||
RunApply(node, extraArgs)
|
RunApply(true, node, extraArgs)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunApply(node string, extraArgs []string) {
|
func RunApply(kubeconfig bool, node string, extraArgs []string) {
|
||||||
taloscmds := gencmd.GenApply(node, extraArgs)
|
taloscmds := gencmd.GenApply(node, extraArgs)
|
||||||
gencmd.ExecCmds(taloscmds, true)
|
gencmd.ExecCmds(taloscmds, true)
|
||||||
|
|
||||||
|
if kubeconfig {
|
||||||
kubeconfigcmds := gencmd.GenKubeConfig(helper.TalEnv["VIP_IP"])
|
kubeconfigcmds := gencmd.GenKubeConfig(helper.TalEnv["VIP_IP"])
|
||||||
gencmd.ExecCmd(kubeconfigcmds)
|
gencmd.ExecCmd(kubeconfigcmds)
|
||||||
|
|
||||||
if helper.GetYesOrNo("Do you want to (re)load ssh, Sops and ClusterEnv onto the cluster? (yes/no) [y/n]: ") {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if helper.GetYesOrNo("Do you want to (re)load ssh, Sops and ClusterEnv onto the cluster? (yes/no) [y/n]: ") {
|
||||||
|
//
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/truecharts/public/clustertool/pkg/gencmd"
|
"github.com/truecharts/public/clustertool/pkg/gencmd"
|
||||||
"github.com/truecharts/public/clustertool/pkg/helper"
|
|
||||||
"github.com/truecharts/public/clustertool/pkg/nodestatus"
|
|
||||||
"github.com/truecharts/public/clustertool/pkg/sops"
|
"github.com/truecharts/public/clustertool/pkg/sops"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,14 +29,6 @@ var genConfig = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
gencmd.GenConfig(args)
|
gencmd.GenConfig(args)
|
||||||
err := nodestatus.CheckHealth(helper.TalEnv["VIP_IP"], "", true)
|
|
||||||
if err == nil {
|
|
||||||
log.Info().Msg("Running Cluster Detected, setting KubeConfig...")
|
|
||||||
kubeconfigcmds := gencmd.GenKubeConfig(helper.TalEnv["VIP_IP"])
|
|
||||||
gencmd.ExecCmd(kubeconfigcmds)
|
|
||||||
} else {
|
|
||||||
log.Info().Msg("No Running Cluster Detected, Skipping KubeConfig...")
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user