mirror of https://github.com/kubernetes/kops.git
validate cluster twice
This commit is contained in:
parent
dec416ffb0
commit
44183aef7f
|
@ -415,6 +415,7 @@ func RunRollingUpdateCluster(f *util.Factory, out io.Writer, options *RollingUpd
|
||||||
ValidationTimeout: options.ValidationTimeout,
|
ValidationTimeout: options.ValidationTimeout,
|
||||||
// TODO should we expose this to the UI?
|
// TODO should we expose this to the UI?
|
||||||
ValidateTickDuration: 30 * time.Second,
|
ValidateTickDuration: 30 * time.Second,
|
||||||
|
ValidateSuccessDuration: 10 * time.Second,
|
||||||
}
|
}
|
||||||
return d.RollingUpdate(groups, cluster, list)
|
return d.RollingUpdate(groups, cluster, list)
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,9 +262,16 @@ func (r *RollingUpdateInstanceGroup) tryValidateCluster(rollingUpdateData *Rolli
|
||||||
klog.Infof("Cluster did not pass validation, will try again in %q until duration %q expires: %s.", tickDuration, duration, strings.Join(messages, ", "))
|
klog.Infof("Cluster did not pass validation, will try again in %q until duration %q expires: %s.", tickDuration, duration, strings.Join(messages, ", "))
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
|
klog.Info("Cluster validated, revalidating to make sure it does not flap.")
|
||||||
|
time.Sleep(rollingUpdateData.ValidateSuccessDuration)
|
||||||
|
result, err = rollingUpdateData.ClusterValidator.Validate()
|
||||||
|
if err == nil && len(result.Failures) == 0 {
|
||||||
klog.Info("Cluster validated.")
|
klog.Info("Cluster validated.")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
klog.Info("Cluster did not revalidate.")
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// validateCluster runs our validation methods on the K8s Cluster.
|
// validateCluster runs our validation methods on the K8s Cluster.
|
||||||
|
|
|
@ -63,6 +63,10 @@ type RollingUpdateCluster struct {
|
||||||
|
|
||||||
// ValidateTickDuration is the amount of time to wait between cluster validation attempts
|
// ValidateTickDuration is the amount of time to wait between cluster validation attempts
|
||||||
ValidateTickDuration time.Duration
|
ValidateTickDuration time.Duration
|
||||||
|
|
||||||
|
// ValidateSuccessDuration is the amount of time a cluster must continue to validate successfully
|
||||||
|
// before updating the next node
|
||||||
|
ValidateSuccessDuration time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
// RollingUpdate performs a rolling update on a K8s Cluster.
|
// RollingUpdate performs a rolling update on a K8s Cluster.
|
||||||
|
|
|
@ -55,6 +55,7 @@ func getTestSetup() (*RollingUpdateCluster, awsup.AWSCloud, *kopsapi.Cluster) {
|
||||||
ClusterValidator: &successfulClusterValidator{},
|
ClusterValidator: &successfulClusterValidator{},
|
||||||
FailOnValidate: true,
|
FailOnValidate: true,
|
||||||
ValidateTickDuration: 1 * time.Millisecond,
|
ValidateTickDuration: 1 * time.Millisecond,
|
||||||
|
ValidateSuccessDuration: 5 * time.Millisecond,
|
||||||
}
|
}
|
||||||
|
|
||||||
return c, mockcloud, cluster
|
return c, mockcloud, cluster
|
||||||
|
|
Loading…
Reference in New Issue