@@ -20,6 +20,7 @@ import (
20
20
"net/http"
21
21
"os"
22
22
"strconv"
23
+ "strings"
23
24
"time"
24
25
25
26
log "github.com/sirupsen/logrus"
@@ -236,17 +237,24 @@ func PersistentVolExists(kubeClientset kubernetes.Interface, name, expectedPhase
236
237
}
237
238
238
239
func PersistentVolClaimExists (kubeClientset kubernetes.Interface , name , expectedPhase string , namespace string ) error {
239
- vol , err := util .RetryOnError (& util .DefaultRetry , util .IsRetriable , func () (interface {}, error ) {
240
- return GetPersistentVolumeClaim (kubeClientset , name , namespace )
241
- })
242
- if err != nil {
243
- return err
244
- }
245
- phase := string (vol .(* corev1.PersistentVolumeClaim ).Status .Phase )
246
- if phase != expectedPhase {
247
- return fmt .Errorf ("persistentvolumeclaim had unexpected phase %v, expected phase %v" , phase , expectedPhase )
248
- }
249
- return nil
240
+ _ , err := util .RetryOnError (
241
+ & util .DefaultRetry ,
242
+ func (err error ) bool {
243
+ msg := fmt .Sprintf ("persistentvolumeclaim had unexpected phase" )
244
+ return util .IsRetriable (err ) || strings .Contains (err .Error (), msg )
245
+ },
246
+ func () (interface {}, error ) {
247
+ vol , err := GetPersistentVolumeClaim (kubeClientset , name , namespace )
248
+ if err != nil {
249
+ return nil , err
250
+ }
251
+ phase := string (vol .Status .Phase )
252
+ if phase != expectedPhase {
253
+ return nil , fmt .Errorf ("persistentvolumeclaim had unexpected phase %v, expected phase %v" , phase , expectedPhase )
254
+ }
255
+ return nil , nil
256
+ })
257
+ return err
250
258
}
251
259
252
260
func ValidatePrometheusVolumeClaimTemplatesName (kubeClientset kubernetes.Interface , statefulsetName , namespace , volumeClaimTemplatesName string ) error {
0 commit comments