Skip to content

Commit

Permalink
validate loop
Browse files Browse the repository at this point in the history
  • Loading branch information
zetaab committed Dec 10, 2019
1 parent dec416f commit 2b954ec
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/instancegroups/instancegroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (r *RollingUpdateInstanceGroup) RollingUpdate(rollingUpdateData *RollingUpd
} else if featureflag.DrainAndValidateRollingUpdate.Enabled() {
klog.Info("Validating the cluster.")

if err = r.validateClusterWithDuration(rollingUpdateData, validationTimeout); err != nil {
if err = r.validateClusterWithDurationLoop(rollingUpdateData, validationTimeout); err != nil {

if rollingUpdateData.FailOnValidate {
klog.Errorf("Cluster did not validate within %s", validationTimeout)
Expand Down Expand Up @@ -248,6 +248,19 @@ func (r *RollingUpdateInstanceGroup) validateClusterWithDuration(rollingUpdateDa
}
}

// validateClusterWithDurationLoop validates cluster 3 times to make sure cluster does not flap
func (r *RollingUpdateInstanceGroup) validateClusterWithDurationLoop(rollingUpdateData *RollingUpdateCluster, duration time.Duration) error {
var err error
for i := 1; i <= 3; i++ {
err = r.validateClusterWithDuration(rollingUpdateData, duration)
if err != nil {
return err
}
time.Sleep(5 * time.Second)
}
return nil
}

func (r *RollingUpdateInstanceGroup) tryValidateCluster(rollingUpdateData *RollingUpdateCluster, duration time.Duration, tickDuration time.Duration) bool {
result, err := rollingUpdateData.ClusterValidator.Validate()

Expand Down

0 comments on commit 2b954ec

Please sign in to comment.