Skip to content

Commit

Permalink
fix: scale to 1 rather than 0 on start
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec committed May 19, 2021
1 parent ea4e910 commit 2a23cb8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v0.0.13 (2021-05-18)

* [ea4e910](https://github.com/argoproj/argo-workflows/commit/ea4e910597a1de3a99406523fdab0feadf14a116) docs: updated CHANGELOG.md
* [6204cd1](https://github.com/argoproj/argo-workflows/commit/6204cd1b085b354647495ec9866b1629fc474eb4) fix: surface errors
* [c000e41](https://github.com/argoproj/argo-workflows/commit/c000e4152710e9a1a1d78516e396b3892ed55e7f) fix: make minReplicas required

### Contributors

* Alex Collins

## v0.0.12 (2021-05-18)

* [3089119](https://github.com/argoproj/argo-workflows/commit/3089119f0447727cd493b1116244d90ac6dc3a1e) fix: only terminate sidecars if the main container exit with code 0
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/step_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ func (in *Step) GetTargetReplicas(scalingDelay, peekDelay time.Duration) int {
targetReplicas := in.Spec.CalculateReplicas(pending)

// do we need to peek? currentReplicas and targetReplicas must both be zero
if currentReplicas == 0 && targetReplicas == 0 && time.Since(lastScaledAt) > peekDelay {
if currentReplicas <= 0 && targetReplicas == 0 && time.Since(lastScaledAt) > peekDelay {
return 1
}

return targetReplicas
}

func RequeueAfter(currentReplicas, targetReplicas int, scalingDelay time.Duration) time.Duration {
if currentReplicas == 0 && targetReplicas == 0 {
if currentReplicas <= 0 && targetReplicas == 0 {
return scalingDelay
}
return 0
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/step_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestStep_GetTargetReplicas(t *testing.T) {
t.Run("Init", func(t *testing.T) {
t.Run("Min=0", func(t *testing.T) {
s := &Step{Spec: StepSpec{Scale: &Scale{MinReplicas: 0}}}
assert.Equal(t, 0, s.GetTargetReplicas(scalingDelay, peekDelay))
assert.Equal(t, 1, s.GetTargetReplicas(scalingDelay, peekDelay))
})
t.Run("Min=1", func(t *testing.T) {
s := &Step{Spec: StepSpec{Scale: &Scale{MinReplicas: 1}}}
Expand Down

0 comments on commit 2a23cb8

Please sign in to comment.