Skip to content

Commit c9ed50b

Browse files
authored
Reconcile fix (#2208)
Signed-off-by: jose.vazquez <[email protected]>
1 parent 67d02e9 commit c9ed50b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

internal/translation/deployment/compare.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ func computeAutoscalingConfigAreEqual(desired, current *akov2.ComputeSpec) bool
314314
return false
315315
}
316316

317-
if desired.MinInstanceSize != current.MinInstanceSize {
317+
scaleDown := current.ScaleDownEnabled != nil && *current.ScaleDownEnabled
318+
if scaleDown && (desired.MinInstanceSize != current.MinInstanceSize) {
318319
return false
319320
}
320321

internal/translation/deployment/compare_test.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,14 +1779,27 @@ func TestComputeAutoscalingConfigAreEqual(t *testing.T) {
17791779
ScaleDownEnabled: pointer.MakePtr(false),
17801780
},
17811781
},
1782-
"should return false when min instance has changed": {
1782+
"should return false when min instance has changed and scale down is enabled": {
17831783
akoAutoscaling: &akov2.ComputeSpec{
1784-
MinInstanceSize: "M20",
1784+
ScaleDownEnabled: pointer.MakePtr(true),
1785+
MinInstanceSize: "M20",
17851786
},
17861787
atlasAutoscaling: &akov2.ComputeSpec{
1787-
MinInstanceSize: "M10",
1788+
ScaleDownEnabled: pointer.MakePtr(true),
1789+
MinInstanceSize: "M10",
17881790
},
17891791
},
1792+
"should return true when min instance has changed and scale down is disabled": {
1793+
akoAutoscaling: &akov2.ComputeSpec{
1794+
ScaleDownEnabled: pointer.MakePtr(false),
1795+
MinInstanceSize: "M20",
1796+
},
1797+
atlasAutoscaling: &akov2.ComputeSpec{
1798+
ScaleDownEnabled: pointer.MakePtr(false),
1799+
MinInstanceSize: "M10",
1800+
},
1801+
expected: true,
1802+
},
17901803
"should return false when max instance has changed": {
17911804
akoAutoscaling: &akov2.ComputeSpec{
17921805
MaxInstanceSize: "M20",

0 commit comments

Comments
 (0)