Skip to content

Commit 2a23cb8

Browse files
committed
fix: scale to 1 rather than 0 on start
1 parent ea4e910 commit 2a23cb8

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## v0.0.13 (2021-05-18)
4+
5+
* [ea4e910](https://github.com/argoproj/argo-workflows/commit/ea4e910597a1de3a99406523fdab0feadf14a116) docs: updated CHANGELOG.md
6+
* [6204cd1](https://github.com/argoproj/argo-workflows/commit/6204cd1b085b354647495ec9866b1629fc474eb4) fix: surface errors
7+
* [c000e41](https://github.com/argoproj/argo-workflows/commit/c000e4152710e9a1a1d78516e396b3892ed55e7f) fix: make minReplicas required
8+
9+
### Contributors
10+
11+
* Alex Collins
12+
313
## v0.0.12 (2021-05-18)
414

515
* [3089119](https://github.com/argoproj/argo-workflows/commit/3089119f0447727cd493b1116244d90ac6dc3a1e) fix: only terminate sidecars if the main container exit with code 0

api/v1alpha1/step_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ func (in *Step) GetTargetReplicas(scalingDelay, peekDelay time.Duration) int {
4949
targetReplicas := in.Spec.CalculateReplicas(pending)
5050

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

5656
return targetReplicas
5757
}
5858

5959
func RequeueAfter(currentReplicas, targetReplicas int, scalingDelay time.Duration) time.Duration {
60-
if currentReplicas == 0 && targetReplicas == 0 {
60+
if currentReplicas <= 0 && targetReplicas == 0 {
6161
return scalingDelay
6262
}
6363
return 0

api/v1alpha1/step_types_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestStep_GetTargetReplicas(t *testing.T) {
1717
t.Run("Init", func(t *testing.T) {
1818
t.Run("Min=0", func(t *testing.T) {
1919
s := &Step{Spec: StepSpec{Scale: &Scale{MinReplicas: 0}}}
20-
assert.Equal(t, 0, s.GetTargetReplicas(scalingDelay, peekDelay))
20+
assert.Equal(t, 1, s.GetTargetReplicas(scalingDelay, peekDelay))
2121
})
2222
t.Run("Min=1", func(t *testing.T) {
2323
s := &Step{Spec: StepSpec{Scale: &Scale{MinReplicas: 1}}}

0 commit comments

Comments
 (0)