mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-17 15:50:10 +00:00
eliminate recursive call attemptToUpdateMasterRoleLabelsAndTaints
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
This commit is contained in:
parent
e4e3e41522
commit
f3c5a6ef8f
@ -177,21 +177,22 @@ func attemptToUpdateMasterRoleLabelsAndTaints(client *clientset.Clientset, sched
|
|||||||
n.ObjectMeta.Annotations[api.TaintsAnnotationKey] = string(taintsAnnotation)
|
n.ObjectMeta.Annotations[api.TaintsAnnotationKey] = string(taintsAnnotation)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := client.Nodes().Update(n); err != nil {
|
for {
|
||||||
if apierrs.IsConflict(err) {
|
if _, err := client.Nodes().Update(n); err != nil {
|
||||||
fmt.Println("<master/apiclient> temporarily unable to update master node metadata due to conflict (will retry)")
|
if apierrs.IsConflict(err) {
|
||||||
time.Sleep(apiCallRetryInterval)
|
fmt.Println("<master/apiclient> temporarily unable to update master node metadata due to conflict (will retry)")
|
||||||
attemptToUpdateMasterRoleLabelsAndTaints(client, schedulable)
|
time.Sleep(apiCallRetryInterval)
|
||||||
|
} else {
|
||||||
|
return err
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateMasterRoleLabelsAndTaints(client *clientset.Clientset, schedulable bool) error {
|
func UpdateMasterRoleLabelsAndTaints(client *clientset.Clientset, schedulable bool) error {
|
||||||
// TODO(phase1+) use iterate instead of recursion
|
|
||||||
err := attemptToUpdateMasterRoleLabelsAndTaints(client, schedulable)
|
err := attemptToUpdateMasterRoleLabelsAndTaints(client, schedulable)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("<master/apiclient> failed to update master node - %v", err)
|
return fmt.Errorf("<master/apiclient> failed to update master node - %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user