From c44f733f2b20c1e2d75664f4b71066b35ea6bc3b Mon Sep 17 00:00:00 2001 From: Derek Wang Date: Mon, 19 Sep 2022 16:23:31 -0700 Subject: [PATCH] fix: use scale.max if it is set (#179) Signed-off-by: Derek Wang Signed-off-by: Derek Wang --- pkg/apis/numaflow/v1alpha1/vertex_types.go | 2 +- pkg/apis/numaflow/v1alpha1/vertex_types_test.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/apis/numaflow/v1alpha1/vertex_types.go b/pkg/apis/numaflow/v1alpha1/vertex_types.go index 4fff97c8f..51404c324 100644 --- a/pkg/apis/numaflow/v1alpha1/vertex_types.go +++ b/pkg/apis/numaflow/v1alpha1/vertex_types.go @@ -469,7 +469,7 @@ func (s Scale) GetMinReplicas() int32 { } func (s Scale) GetMaxReplicas() int32 { - if x := s.Max; x == nil || *x > DefaultMaxReplicas { + if x := s.Max; x == nil { return DefaultMaxReplicas } else { return *x diff --git a/pkg/apis/numaflow/v1alpha1/vertex_types_test.go b/pkg/apis/numaflow/v1alpha1/vertex_types_test.go index b9ce79a36..3f02e6dee 100644 --- a/pkg/apis/numaflow/v1alpha1/vertex_types_test.go +++ b/pkg/apis/numaflow/v1alpha1/vertex_types_test.go @@ -407,4 +407,6 @@ func Test_Scale_Parameters(t *testing.T) { assert.Equal(t, int(tbu), s.GetTargetBufferUsage()) assert.Equal(t, int(tps), s.GetTargetProcessingSeconds()) assert.Equal(t, int(zrss), s.GetZeroReplicaSleepSeconds()) + s.Max = pointer.Int32(500) + assert.Equal(t, int32(500), s.GetMaxReplicas()) }