fix(clustertool): fix kubeconfig not boing loaded correctly and put some more silence into healthchecks
This commit is contained in:
@@ -53,9 +53,9 @@ func RunBootstrap(args []string) {
|
||||
log.Info().Msgf("Bootstrap: waiting for VIP %v to come online...", helper.TalEnv["VIP_IP"])
|
||||
nodestatus.WaitForHealth(helper.TalEnv["VIP_IP"], []string{"running"})
|
||||
|
||||
log.Info().Msgf("Bootstrap: Configuring kubectl for VIP: %v", helper.TalEnv["VIP_IP"])
|
||||
log.Info().Msgf("Bootstrap: Configuring kubeconfig/kubectl for VIP: %v", helper.TalEnv["VIP_IP"])
|
||||
// Ensure kubeconfig is loaded
|
||||
kubeconfigcmds := GenPlain("health", helper.TalEnv["VIP_IP"], extraArgs)
|
||||
kubeconfigcmds := GenPlain("kubeconfig", helper.TalEnv["VIP_IP"], extraArgs)
|
||||
ExecCmd(kubeconfigcmds[0])
|
||||
|
||||
// Desired pod names
|
||||
|
||||
@@ -15,8 +15,8 @@ func CheckHealth(node string, status string, silent bool) error {
|
||||
if err != nil {
|
||||
errstring := "healthcheck failed. status: " + string(out) + " error: " + err.Error()
|
||||
if !silent {
|
||||
log.Info().Msgf("Healthcheck: check on node : failed %v", node)
|
||||
log.Info().Msgf("failed with error: %s", errstring)
|
||||
log.Error().Msgf("Healthcheck: check on node : failed %v", node)
|
||||
log.Error().Msgf("failed with error: %s", errstring)
|
||||
}
|
||||
log.Error().Err(err).Str("node", node).Msg("Healthcheck failed")
|
||||
return errors.New(errstring)
|
||||
@@ -36,17 +36,22 @@ func CheckHealth(node string, status string, silent bool) error {
|
||||
response := "Healthcheck: WARN detected node " + node + " in mode " + "maintenance" + ".\nLikely a new node, so trying commands anyway. Continuing..."
|
||||
log.Warn().Msg(response)
|
||||
} else if status == "" && strings.Contains(out, "running") {
|
||||
_, err = CheckReadyStatus(node)
|
||||
_, err = CheckReadyStatus(node, silent)
|
||||
if err != nil {
|
||||
|
||||
errstring := "healthcheck failed. status: " + string(out) + " error: " + err.Error()
|
||||
log.Error().Err(err).Str("node", node).Msg("Healthcheck failed while checking readiness")
|
||||
|
||||
if !silent {
|
||||
log.Error().Err(err).Str("node", node).Msg("Healthcheck failed while checking readiness")
|
||||
}
|
||||
return errors.New(errstring)
|
||||
}
|
||||
} else {
|
||||
if !silent {
|
||||
log.Info().Msgf("Healthcheck: check on node : failed %v", node)
|
||||
log.Error().Str("node", node).Msg("Healthcheck failed with unexpected status")
|
||||
}
|
||||
log.Error().Str("node", node).Msg("Healthcheck failed with unexpected status")
|
||||
|
||||
return errors.New("healthcheck failed")
|
||||
}
|
||||
log.Debug().Str("node", node).Msg("Health check completed successfully")
|
||||
@@ -83,7 +88,7 @@ func WaitForHealth(node string, status []string) (string, error) {
|
||||
log.Debug().Str("node", node).Str("check", check).Msg("Performing initial health check")
|
||||
err := CheckHealth(node, check, true)
|
||||
if err == nil {
|
||||
log.Info().Str("node", node).Str("status", check).Msg("Initial health check passed")
|
||||
log.Debug().Str("node", node).Str("status", check).Msg("Initial health check passed")
|
||||
return check, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ func CheckStatus(node string) (string, error) {
|
||||
return string(out), nil
|
||||
}
|
||||
|
||||
func CheckReadyStatus(node string) (string, error) {
|
||||
func CheckReadyStatus(node string, silent bool) (string, error) {
|
||||
log.Info().Str("node", node).Msg("Checking node readiness status")
|
||||
|
||||
argsslice := append(baseStatusCMD(node), "-o", "jsonpath={.spec.status.ready}")
|
||||
@@ -83,7 +83,9 @@ func CheckReadyStatus(node string) (string, error) {
|
||||
|
||||
if err != nil {
|
||||
errstring := "status: " + string(out) + " error: " + err.Error()
|
||||
log.Error().Msg(errstring)
|
||||
if !silent {
|
||||
log.Error().Msg(errstring)
|
||||
}
|
||||
return "ERROR", errors.New(errstring)
|
||||
}
|
||||
if strings.Contains(string(out), "true") {
|
||||
|
||||
Reference in New Issue
Block a user