change aws encryptedCheck to exponential backoff

This commit is contained in:
Ruslan Gustomiasov 2019-05-31 23:00:33 +02:00
parent b7fa33ec15
commit e691f7d493

View File

@ -225,12 +225,13 @@ const (
createTagFactor = 2.0 createTagFactor = 2.0
createTagSteps = 9 createTagSteps = 9
// encryptedCheck* is configuration of poll for created volume to check // encryptedCheck* is configuration of exponential backoff for created volume to check
// it has not been silently removed by AWS. // it has not been silently removed by AWS.
// On a random AWS account (shared among several developers) it took 4s on // On a random AWS account (shared among several developers) it took 4s on
// average. // average, 8s max.
encryptedCheckInterval = 1 * time.Second encryptedCheckInitialDelay = 1 * time.Second
encryptedCheckTimeout = 30 * time.Second encryptedCheckFactor = 2.0
encryptedCheckSteps = 8
// Number of node names that can be added to a filter. The AWS limit is 200 // Number of node names that can be added to a filter. The AWS limit is 200
// but we are using a lower limit on purpose // but we are using a lower limit on purpose
@ -2419,8 +2420,12 @@ func (c *Cloud) waitUntilVolumeAvailable(volumeName KubernetesVolumeID) error {
// Unreachable code // Unreachable code
return err return err
} }
backoff := wait.Backoff{
err = wait.Poll(encryptedCheckInterval, encryptedCheckTimeout, func() (done bool, err error) { Duration: encryptedCheckInitialDelay,
Factor: encryptedCheckFactor,
Steps: encryptedCheckSteps,
}
err = wait.ExponentialBackoff(backoff, func() (done bool, err error) {
vol, err := disk.describeVolume() vol, err := disk.describeVolume()
if err != nil { if err != nil {
return true, err return true, err