Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: zachaller <[email protected]>
  • Loading branch information
zachaller committed Aug 23, 2022
1 parent 81e7aac commit 6d75be7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
13 changes: 2 additions & 11 deletions rollout/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ func (c *rolloutContext) calculateRolloutConditions(newStatus v1alpha1.RolloutSt
}

if conditions.RolloutCompleted(c.rollout, &newStatus) {
// The event gets triggered in function promoteStable
updateCompletedCond := conditions.NewRolloutCondition(v1alpha1.RolloutCompleted, corev1.ConditionTrue,
conditions.RolloutCompletedReason, conditions.RolloutCompletedReason)
conditions.SetRolloutCondition(&newStatus, *updateCompletedCond)
Expand All @@ -686,7 +687,7 @@ func (c *rolloutContext) calculateRolloutConditions(newStatus v1alpha1.RolloutSt
conditions.RolloutCompletedReason, conditions.RolloutCompletedReason)
if conditions.SetRolloutCondition(&newStatus, *updateCompletedCond) {
revision, _ := replicasetutil.Revision(c.rollout)
c.recorder.Eventf(c.rollout, record.EventOptions{EventReason: "RolloutNotCompleted"},
c.recorder.Eventf(c.rollout, record.EventOptions{EventReason: conditions.RolloutNotCompletedReason},
conditions.RolloutNotCompletedMessage, revision+1, newStatus.CurrentPodHash)
}
}
Expand Down Expand Up @@ -946,16 +947,6 @@ func (c *rolloutContext) promoteStable(newStatus *v1alpha1.RolloutStatus, reason
revision, _ := replicasetutil.Revision(c.rollout)
c.recorder.Eventf(c.rollout, record.EventOptions{EventReason: conditions.RolloutCompletedReason},
conditions.RolloutCompletedMessage, revision, newStatus.CurrentPodHash, reason)

//if conditions.RolloutCompleted(c.rollout, newStatus) {
// updateCompletedCond := conditions.NewRolloutCondition(v1alpha1.RolloutCompleted, corev1.ConditionTrue,
// conditions.RolloutCompletedReason, conditions.RolloutCompletedReason)
// if conditions.SetRolloutCondition(newStatus, *updateCompletedCond) {
// revision, _ := replicasetutil.Revision(c.rollout)
// c.recorder.Eventf(c.rollout, record.EventOptions{EventReason: conditions.RolloutCompletedReason},
// conditions.RolloutCompletedMessage, revision, newStatus.CurrentPodHash, reason)
// }
//}
}
return nil
}
2 changes: 2 additions & 0 deletions utils/conditions/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ const (
RolloutCompletedReason = "RolloutCompleted"
// RolloutCompletedMessage is added when the rollout is completed
RolloutCompletedMessage = "Rollout completed update to revision %d (%s): %s"
// RolloutNotCompletedReason is added in a rollout when it is completed.
RolloutNotCompletedReason = "RolloutNotCompleted"
// RolloutNotCompletedMessage is added when the rollout is completed
RolloutNotCompletedMessage = "Rollout not completed, started update to revision %d (%s)"

Expand Down
2 changes: 1 addition & 1 deletion utils/conditions/rollouts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ func TestRolloutProgressing(t *testing.T) {

}

func TestRolloutHealthyAndComplete(t *testing.T) {
func TestRolloutHealthyAndCompleted(t *testing.T) {
rollout := func(desired, current, updated, available int32, correctObservedGeneration bool) *v1alpha1.Rollout {
r := &v1alpha1.Rollout{
Spec: v1alpha1.RolloutSpec{
Expand Down

0 comments on commit 6d75be7

Please sign in to comment.