Skip to content

Commit 8b3a114

Browse files
authored
Revert "CLOUDP-342256: Add predictiveAutoscaling Field (#2639)" (#2722)
1 parent 7490186 commit 8b3a114

File tree

7 files changed

+20
-181
lines changed

7 files changed

+20
-181
lines changed

api/v1/atlasdeployment_types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,6 @@ type ComputeSpec struct {
353353
// Maximum instance size to which your deployment can automatically scale (such as M40). Atlas requires this parameter if "autoScaling.compute.enabled" : true.
354354
// +optional
355355
MaxInstanceSize string `json:"maxInstanceSize,omitempty"`
356-
357-
// Flag that indicates whether predictive instance size auto-scaling is enabled.
358-
// +optional
359-
PredictiveEnabled *bool `json:"predictiveEnabled,omitempty"`
360356
}
361357

362358
type ProcessArgs struct {

api/v1/zz_generated.deepcopy.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/atlas.mongodb.com_atlasdeployments.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,6 @@ spec:
289289
if "autoScaling.compute.scaleDownEnabled"
290290
: true.'
291291
type: string
292-
predictiveEnabled:
293-
description: Flag that indicates whether predictive
294-
instance size auto-scaling is enabled.
295-
type: boolean
296292
scaleDownEnabled:
297293
description: 'Flag that indicates whether
298294
the deployment tier may scale down. Atlas
@@ -824,10 +820,6 @@ spec:
824820
Atlas requires this parameter if "autoScaling.compute.scaleDownEnabled"
825821
: true.'
826822
type: string
827-
predictiveEnabled:
828-
description: Flag that indicates whether predictive
829-
instance size auto-scaling is enabled.
830-
type: boolean
831823
scaleDownEnabled:
832824
description: 'Flag that indicates whether the deployment
833825
tier may scale down. Atlas requires this parameter

internal/controller/atlasdeployment/advanced_deployment_test.go

Lines changed: 0 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -949,129 +949,6 @@ func TestHandleAdvancedDeployment(t *testing.T) {
949949
WithMessageRegexp("Cluster upgrade to dedicated instance initiated in Atlas. The process may take several minutes"),
950950
},
951951
},
952-
"enable autoscaling with predictive autoscaling": {
953-
atlasDeployment: &akov2.AtlasDeployment{
954-
ObjectMeta: metav1.ObjectMeta{
955-
Name: "cluster0",
956-
Namespace: "test",
957-
},
958-
Spec: akov2.AtlasDeploymentSpec{
959-
DeploymentSpec: &akov2.AdvancedDeploymentSpec{
960-
Name: "cluster0",
961-
ClusterType: "REPLICASET",
962-
ReplicationSpecs: []*akov2.AdvancedReplicationSpec{
963-
{
964-
RegionConfigs: []*akov2.AdvancedRegionConfig{
965-
{
966-
ProviderName: "AWS",
967-
RegionName: "US_WEST_1",
968-
Priority: pointer.MakePtr(7),
969-
ElectableSpecs: &akov2.Specs{
970-
InstanceSize: "M20",
971-
NodeCount: pointer.MakePtr(3),
972-
},
973-
AutoScaling: &akov2.AdvancedAutoScalingSpec{
974-
Compute: &akov2.ComputeSpec{
975-
Enabled: pointer.MakePtr(true),
976-
ScaleDownEnabled: pointer.MakePtr(false),
977-
MinInstanceSize: "M20",
978-
MaxInstanceSize: "M40",
979-
PredictiveEnabled: pointer.MakePtr(true),
980-
},
981-
},
982-
},
983-
},
984-
},
985-
},
986-
},
987-
},
988-
},
989-
deploymentInAtlas: &deployment.Cluster{
990-
ProjectID: "project-id",
991-
State: "IDLE",
992-
AdvancedDeploymentSpec: &akov2.AdvancedDeploymentSpec{
993-
Name: "cluster0",
994-
ClusterType: "REPLICASET",
995-
ReplicationSpecs: []*akov2.AdvancedReplicationSpec{
996-
{
997-
RegionConfigs: []*akov2.AdvancedRegionConfig{
998-
{
999-
ProviderName: "AWS",
1000-
RegionName: "US_WEST_1",
1001-
Priority: pointer.MakePtr(7),
1002-
ElectableSpecs: &akov2.Specs{
1003-
InstanceSize: "M20",
1004-
NodeCount: pointer.MakePtr(3),
1005-
},
1006-
AutoScaling: &akov2.AdvancedAutoScalingSpec{
1007-
Compute: &akov2.ComputeSpec{
1008-
Enabled: pointer.MakePtr(false),
1009-
},
1010-
DiskGB: &akov2.DiskGB{
1011-
Enabled: pointer.MakePtr(false),
1012-
},
1013-
},
1014-
},
1015-
},
1016-
},
1017-
},
1018-
},
1019-
},
1020-
deploymentService: func() deployment.AtlasDeploymentsService {
1021-
service := translation.NewAtlasDeploymentsServiceMock(t)
1022-
1023-
service.EXPECT().UpdateDeployment(context.Background(), mock.AnythingOfType("*deployment.Cluster")).
1024-
Return(
1025-
&deployment.Cluster{
1026-
ProjectID: "project-id",
1027-
State: "UPDATING",
1028-
AdvancedDeploymentSpec: &akov2.AdvancedDeploymentSpec{
1029-
Name: "cluster0",
1030-
ClusterType: "REPLICASET",
1031-
ReplicationSpecs: []*akov2.AdvancedReplicationSpec{
1032-
{
1033-
RegionConfigs: []*akov2.AdvancedRegionConfig{
1034-
{
1035-
ProviderName: "AWS",
1036-
RegionName: "US_WEST_1",
1037-
Priority: pointer.MakePtr(7),
1038-
ElectableSpecs: &akov2.Specs{
1039-
InstanceSize: "M20",
1040-
NodeCount: pointer.MakePtr(3),
1041-
},
1042-
AutoScaling: &akov2.AdvancedAutoScalingSpec{
1043-
Compute: &akov2.ComputeSpec{
1044-
Enabled: pointer.MakePtr(true),
1045-
ScaleDownEnabled: pointer.MakePtr(false),
1046-
MinInstanceSize: "M20",
1047-
MaxInstanceSize: "M40",
1048-
PredictiveEnabled: pointer.MakePtr(true),
1049-
},
1050-
},
1051-
},
1052-
},
1053-
},
1054-
},
1055-
},
1056-
},
1057-
nil,
1058-
)
1059-
1060-
return service
1061-
},
1062-
sdkMock: func() *admin.APIClient {
1063-
return &admin.APIClient{}
1064-
},
1065-
expectedResult: workflowRes{
1066-
res: ctrl.Result{RequeueAfter: workflow.DefaultRetry},
1067-
err: nil,
1068-
},
1069-
expectedConditions: []api.Condition{
1070-
api.FalseCondition(api.DeploymentReadyType).
1071-
WithReason(string(workflow.DeploymentUpdating)).
1072-
WithMessageRegexp("deployment is updating"),
1073-
},
1074-
},
1075952
}
1076953

1077954
for name, tt := range tests {

internal/translation/deployment/compare.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,6 @@ func computeAutoscalingConfigAreEqual(desired, current *akov2.ComputeSpec) bool
343343
return false
344344
}
345345

346-
if desired.PredictiveEnabled != nil && !areEqual(desired.PredictiveEnabled, current.PredictiveEnabled) {
347-
return false
348-
}
349-
350346
return true
351347
}
352348

internal/translation/deployment/compare_test.go

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,23 +1874,21 @@ func TestAutoscalingConfigAreEqual(t *testing.T) {
18741874
Enabled: pointer.MakePtr(true),
18751875
},
18761876
Compute: &akov2.ComputeSpec{
1877-
Enabled: pointer.MakePtr(true),
1878-
ScaleDownEnabled: pointer.MakePtr(true),
1879-
MinInstanceSize: "M10",
1880-
MaxInstanceSize: "M40",
1881-
PredictiveEnabled: pointer.MakePtr(true),
1877+
Enabled: pointer.MakePtr(true),
1878+
ScaleDownEnabled: pointer.MakePtr(true),
1879+
MinInstanceSize: "M10",
1880+
MaxInstanceSize: "M40",
18821881
},
18831882
},
18841883
atlasAutoscaling: &akov2.AdvancedAutoScalingSpec{
18851884
DiskGB: &akov2.DiskGB{
18861885
Enabled: pointer.MakePtr(true),
18871886
},
18881887
Compute: &akov2.ComputeSpec{
1889-
Enabled: pointer.MakePtr(true),
1890-
ScaleDownEnabled: pointer.MakePtr(true),
1891-
MinInstanceSize: "M10",
1892-
MaxInstanceSize: "M40",
1893-
PredictiveEnabled: pointer.MakePtr(true),
1888+
Enabled: pointer.MakePtr(true),
1889+
ScaleDownEnabled: pointer.MakePtr(true),
1890+
MinInstanceSize: "M10",
1891+
MaxInstanceSize: "M40",
18941892
},
18951893
},
18961894
expected: true,
@@ -2012,14 +2010,6 @@ func TestComputeAutoscalingConfigAreEqual(t *testing.T) {
20122010
MaxInstanceSize: "M10",
20132011
},
20142012
},
2015-
"should return false when predictive autoscaling has changed": {
2016-
akoAutoscaling: &akov2.ComputeSpec{
2017-
PredictiveEnabled: pointer.MakePtr(true),
2018-
},
2019-
atlasAutoscaling: &akov2.ComputeSpec{
2020-
PredictiveEnabled: pointer.MakePtr(false),
2021-
},
2022-
},
20232013
"should return true when autoscaling enabled flags are unset": {
20242014
akoAutoscaling: &akov2.ComputeSpec{
20252015
MinInstanceSize: "M10",
@@ -2035,18 +2025,16 @@ func TestComputeAutoscalingConfigAreEqual(t *testing.T) {
20352025
},
20362026
"should return true when autoscaling are equal": {
20372027
akoAutoscaling: &akov2.ComputeSpec{
2038-
Enabled: pointer.MakePtr(true),
2039-
ScaleDownEnabled: pointer.MakePtr(true),
2040-
MinInstanceSize: "M10",
2041-
MaxInstanceSize: "M40",
2042-
PredictiveEnabled: pointer.MakePtr(true),
2028+
Enabled: pointer.MakePtr(true),
2029+
ScaleDownEnabled: pointer.MakePtr(true),
2030+
MinInstanceSize: "M10",
2031+
MaxInstanceSize: "M40",
20432032
},
20442033
atlasAutoscaling: &akov2.ComputeSpec{
2045-
Enabled: pointer.MakePtr(true),
2046-
ScaleDownEnabled: pointer.MakePtr(true),
2047-
MinInstanceSize: "M10",
2048-
MaxInstanceSize: "M40",
2049-
PredictiveEnabled: pointer.MakePtr(true),
2034+
Enabled: pointer.MakePtr(true),
2035+
ScaleDownEnabled: pointer.MakePtr(true),
2036+
MinInstanceSize: "M10",
2037+
MaxInstanceSize: "M40",
20502038
},
20512039
expected: true,
20522040
},

internal/translation/deployment/conversion.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -751,11 +751,10 @@ func replicationSpecFromAtlas(replicationSpecs []admin.ReplicationSpec20240805)
751751

752752
if compute.GetEnabled() {
753753
autoscaling.Compute = &akov2.ComputeSpec{
754-
Enabled: compute.Enabled,
755-
ScaleDownEnabled: compute.ScaleDownEnabled,
756-
MinInstanceSize: compute.GetMinInstanceSize(),
757-
MaxInstanceSize: compute.GetMaxInstanceSize(),
758-
PredictiveEnabled: compute.PredictiveEnabled,
754+
Enabled: compute.Enabled,
755+
ScaleDownEnabled: compute.ScaleDownEnabled,
756+
MinInstanceSize: compute.GetMinInstanceSize(),
757+
MaxInstanceSize: compute.GetMaxInstanceSize(),
759758
}
760759
}
761760

@@ -928,10 +927,6 @@ func replicationSpecToAtlas(replicationSpecs []*akov2.AdvancedReplicationSpec, c
928927
if spec.Compute.ScaleDownEnabled != nil && *spec.Compute.ScaleDownEnabled {
929928
autoscaling.Compute.MinInstanceSize = &spec.Compute.MinInstanceSize
930929
}
931-
932-
if spec.Compute.PredictiveEnabled != nil && *spec.Compute.PredictiveEnabled {
933-
autoscaling.Compute.PredictiveEnabled = spec.Compute.PredictiveEnabled
934-
}
935930
}
936931

937932
if diskGBExist {

0 commit comments

Comments
 (0)