Skip to content

Commit

Permalink
fixes according review
Browse files Browse the repository at this point in the history
  • Loading branch information
zetaab committed Dec 11, 2019
1 parent 45cdd20 commit 7af196f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions cmd/kops/rollingupdatecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ func RunRollingUpdateCluster(f *util.Factory, out io.Writer, options *RollingUpd
PostDrainDelay: options.PostDrainDelay,
ValidationTimeout: options.ValidationTimeout,
// TODO should we expose this to the UI?
ValidateTickDuration: 30 * time.Second,
LoopDuration: 5 * time.Second,
ValidateTickDuration: 30 * time.Second,
ValidateSuccessDuration: 15 * time.Second,
}
return d.RollingUpdate(groups, cluster, list)
}
4 changes: 2 additions & 2 deletions pkg/instancegroups/instancegroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,8 @@ func (r *RollingUpdateInstanceGroup) validateClusterWithDurationLoop(rollingUpda
if err != nil {
return err
}
time.Sleep(rollingUpdateData.LoopDuration)
time.Sleep(rollingUpdateData.ValidateSuccessDuration / 3)
}
klog.Info("Cluster validated.")
return nil
}

Expand All @@ -276,6 +275,7 @@ 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, ", "))
return false
} else {
klog.Info("Cluster validated.")
return true
}
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/instancegroups/rollingupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ type RollingUpdateCluster struct {
// ValidateTickDuration is the amount of time to wait between cluster validation attempts
ValidateTickDuration time.Duration

// LoopDuration is the amount of time to wait between cluster validation in loop
LoopDuration 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.
Expand Down
20 changes: 10 additions & 10 deletions pkg/instancegroups/rollingupdate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ func getTestSetup() (*RollingUpdateCluster, awsup.AWSCloud, *kopsapi.Cluster) {
cluster.Name = "test.k8s.local"

c := &RollingUpdateCluster{
Cloud: mockcloud,
MasterInterval: 1 * time.Millisecond,
NodeInterval: 1 * time.Millisecond,
BastionInterval: 1 * time.Millisecond,
Force: false,
K8sClient: k8sClient,
ClusterValidator: &successfulClusterValidator{},
FailOnValidate: true,
ValidateTickDuration: 1 * time.Millisecond,
LoopDuration: 5 * time.Millisecond,
Cloud: mockcloud,
MasterInterval: 1 * time.Millisecond,
NodeInterval: 1 * time.Millisecond,
BastionInterval: 1 * time.Millisecond,
Force: false,
K8sClient: k8sClient,
ClusterValidator: &successfulClusterValidator{},
FailOnValidate: true,
ValidateTickDuration: 1 * time.Millisecond,
ValidateSuccessDuration: 5 * time.Millisecond,
}

return c, mockcloud, cluster
Expand Down

0 comments on commit 7af196f

Please sign in to comment.