mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
e2e: retry getting the Services for Ceph MON on failures
In case listing the Kubernetes Services fails, the following error is returned immediately: failed to create configmap with error failed to list services: etcdserver: request timed out Wrapping the listing of the Services in a PollImmediate() routine, adds a retry in case of common temporary issues. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
5fc9c3a046
commit
a7ff868dae
18
e2e/utils.go
18
e2e/utils.go
@ -71,9 +71,23 @@ func getMons(ns string, c kubernetes.Interface) ([]string, error) {
|
||||
}
|
||||
services := make([]string, 0)
|
||||
|
||||
svcList, err := c.CoreV1().Services(ns).List(context.TODO(), opt)
|
||||
var svcList *v1.ServiceList
|
||||
t := time.Duration(deployTimeout) * time.Minute
|
||||
err := wait.PollImmediate(poll, t, func() (bool, error) {
|
||||
var svcErr error
|
||||
svcList, svcErr = c.CoreV1().Services(ns).List(context.TODO(), opt)
|
||||
if svcErr != nil {
|
||||
if isRetryableAPIError(svcErr) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return false, fmt.Errorf("failed to list Services in namespace %q: %w", ns, svcErr)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
})
|
||||
if err != nil {
|
||||
return services, fmt.Errorf("failed to list services: %w", err)
|
||||
return services, fmt.Errorf("could not get Services: %w", err)
|
||||
}
|
||||
for i := range svcList.Items {
|
||||
s := fmt.Sprintf(
|
||||
|
Loading…
Reference in New Issue
Block a user