Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Commit

Permalink
Add retry loop to removing bootstrap etcd service. (#526)
Browse files Browse the repository at this point in the history
Since the etcd pivot just occurred the apiserver may be temporarily
unavailable. This retries until successful or timeout, but still doesn't
fail the entire process on failure.
  • Loading branch information
diegs authored May 19, 2017
1 parent 237243f commit 88ae095
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/util/etcdutil/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,17 @@ func waitBootEtcdRemoved(etcdServiceIP string) error {
}

func cleanupBootstrapEtcdService(kubecli kubernetes.Interface) {
if err := kubecli.CoreV1().Services(api.NamespaceSystem).Delete(bootstrapEtcdServiceName, &v1.DeleteOptions{}); err != nil {
glog.Errorf("failed to remove bootstrap-etcd-service: %v", err)
if err := wait.Poll(pollInterval, pollTimeout, func() (bool, error) {
if err := kubecli.CoreV1().Services(api.NamespaceSystem).Delete(bootstrapEtcdServiceName, &v1.DeleteOptions{}); err != nil {
if apierrors.IsNotFound(err) {
glog.Info("bootstrap-etcd-service already removed")
return true, nil
}
glog.Errorf("failed to remove bootstrap-etcd-service: %v", err)
return false, nil
}
return true, nil
}); err != nil {
glog.Errorf("timed out removing bootstrap-etcd-service: %v", err)
}
}

0 comments on commit 88ae095

Please sign in to comment.