1
0
mirror of https://github.com/rancher/rke.git synced 2025-04-27 19:25:44 +00:00

Standardize (re-)try logging

This commit is contained in:
Sebastiaan van Steenis 2020-03-21 18:17:32 +01:00
parent cd8271c976
commit 5f46c748c0
4 changed files with 4 additions and 4 deletions

View File

@ -934,7 +934,7 @@ func setNodeAnnotationsLabelsTaints(k8sClient *kubernetes.Clientset, host *hosts
for retries := 0; retries <= 5; retries++ {
node, err = k8s.GetNode(k8sClient, host.HostnameOverride)
if err != nil {
logrus.Debugf("[hosts] Can't find node by name [%s], retrying..", host.HostnameOverride)
logrus.Debugf("[hosts] Can't find node by name [%s], error: %v", host.HostnameOverride, err)
time.Sleep(2 * time.Second)
continue
}

View File

@ -41,7 +41,7 @@ func GetNodeList(k8sClient *kubernetes.Clientset) (*v1.NodeList, error) {
func GetNode(k8sClient *kubernetes.Clientset, nodeName string) (*v1.Node, error) {
var listErr error
for retries := 0; retries < MaxRetries; retries++ {
logrus.Debugf("Checking node list for node %v, retry #%v", nodeName, retries)
logrus.Debugf("Checking node list for node [%v], try #%v", nodeName, retries+1)
nodes, err := GetNodeList(k8sClient)
if err != nil {
listErr = err

View File

@ -47,7 +47,7 @@ func runHealthcheck(ctx context.Context, host *hosts.Host, serviceName string, l
}
for retries := 0; retries < 10; retries++ {
if err = getHealthz(client, serviceName, host.Address, url); err != nil {
logrus.Debugf("[healthcheck] %v", err)
logrus.Debugf("[healthcheck] %v, try #%v", err, retries+1)
time.Sleep(5 * time.Second)
continue
}

View File

@ -19,7 +19,7 @@ import (
func CheckNodeReady(kubeClient *kubernetes.Clientset, runHost *hosts.Host, component string) error {
for retries := 0; retries < k8s.MaxRetries; retries++ {
logrus.Infof("[%s] Now checking status of node %v", component, runHost.HostnameOverride)
logrus.Infof("[%s] Now checking status of node %v, try #%v", component, runHost.HostnameOverride, retries+1)
k8sNode, err := k8s.GetNode(kubeClient, runHost.HostnameOverride)
if err != nil {
return fmt.Errorf("[%s] Error getting node %v: %v", component, runHost.HostnameOverride, err)