Skip to content

Commit 79af623

Browse files
authored
CLOUDP-161565: Remove autoIndexingEnabled flag from AutoScaling (#874)
* deprecate autoIndexingEnabled flag from AutoScaling spec of legacy deployment
1 parent f339138 commit 79af623

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,9 @@ spec:
256256
object.
257257
properties:
258258
autoIndexingEnabled:
259-
description: Flag that indicates whether autopilot mode for
260-
Performance Advisor is enabled. The default is false.
259+
description: 'Deprecated: This flag is not supported anymore.
260+
Flag that indicates whether autopilot mode for Performance
261+
Advisor is enabled. The default is false.'
261262
type: boolean
262263
compute:
263264
description: Collection of settings that configure how a deployment
@@ -424,8 +425,9 @@ spec:
424425
can scale.
425426
properties:
426427
autoIndexingEnabled:
427-
description: Flag that indicates whether autopilot mode
428-
for Performance Advisor is enabled. The default is false.
428+
description: 'Deprecated: This flag is not supported anymore.
429+
Flag that indicates whether autopilot mode for Performance
430+
Advisor is enabled. The default is false.'
429431
type: boolean
430432
compute:
431433
description: Collection of settings that configure how
@@ -653,8 +655,9 @@ spec:
653655
can scale.
654656
properties:
655657
autoIndexingEnabled:
656-
description: Flag that indicates whether autopilot mode
657-
for Performance Advisor is enabled. The default is false.
658+
description: 'Deprecated: This flag is not supported anymore.
659+
Flag that indicates whether autopilot mode for Performance
660+
Advisor is enabled. The default is false.'
658661
type: boolean
659662
compute:
660663
description: Collection of settings that configure how

pkg/api/v1/atlasdeployment_types.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ type Specs struct {
255255

256256
// AutoScalingSpec configures your deployment to automatically scale its storage
257257
type AutoScalingSpec struct {
258+
// Deprecated: This flag is not supported anymore.
258259
// Flag that indicates whether autopilot mode for Performance Advisor is enabled.
259260
// The default is false.
260261
AutoIndexingEnabled *bool `json:"autoIndexingEnabled,omitempty"`
@@ -492,6 +493,15 @@ var _ = RegionsConfig(mongodbatlas.RegionsConfig{})
492493
func (spec *AtlasDeploymentSpec) Deployment() (*mongodbatlas.Cluster, error) {
493494
result := &mongodbatlas.Cluster{}
494495
err := compat.JSONCopy(result, *spec.DeploymentSpec)
496+
497+
if result.AutoScaling != nil {
498+
result.AutoScaling.AutoIndexingEnabled = nil
499+
}
500+
501+
if result.ProviderSettings != nil && result.ProviderSettings.AutoScaling != nil {
502+
result.ProviderSettings.AutoScaling.AutoIndexingEnabled = nil
503+
}
504+
495505
return result, err
496506
}
497507

@@ -670,8 +680,7 @@ func (c *AtlasDeployment) WithDiskSizeGB(size int) *AtlasDeployment {
670680
func (c *AtlasDeployment) WithAutoscalingDisabled() *AtlasDeployment {
671681
f := false
672682
c.Spec.DeploymentSpec.AutoScaling = &AutoScalingSpec{
673-
AutoIndexingEnabled: &f,
674-
DiskGBEnabled: &f,
683+
DiskGBEnabled: &f,
675684
Compute: &ComputeSpec{
676685
Enabled: &f,
677686
ScaleDownEnabled: &f,

pkg/controller/atlasdeployment/deployment.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ func cleanupDeployment(deployment mongodbatlas.Cluster) mongodbatlas.Cluster {
130130
deployment.DiskSizeGB = nil
131131
}
132132

133+
if deployment.AutoScaling != nil {
134+
deployment.AutoScaling.AutoIndexingEnabled = nil
135+
}
136+
137+
if deployment.ProviderSettings != nil && deployment.ProviderSettings.AutoScaling != nil {
138+
deployment.ProviderSettings.AutoScaling.AutoIndexingEnabled = nil
139+
}
140+
133141
return deployment
134142
}
135143

@@ -158,10 +166,13 @@ func removeOutdatedFields(removeFrom *mongodbatlas.Cluster, lookAt *mongodbatlas
158166
result.ProviderSettings.AutoScaling = &mongodbatlas.AutoScaling{}
159167
}
160168
result.ProviderSettings.AutoScaling.Compute = &mongodbatlas.Compute{}
169+
result.ProviderSettings.AutoScaling.AutoIndexingEnabled = nil
161170
}
162171
}
163172

164173
if lookAt.AutoScaling != nil {
174+
result.AutoScaling.AutoIndexingEnabled = nil
175+
165176
if lookAt.AutoScaling.DiskGBEnabled != nil && *lookAt.AutoScaling.DiskGBEnabled {
166177
result.DiskSizeGB = nil
167178
}

test/int/deployment_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,7 @@ var _ = Describe("AtlasDeployment", Label("int", "AtlasDeployment"), func() {
541541
createdDeployment = mdbv1.DefaultAWSDeployment(namespace.Name, createdProject.Name)
542542
createdDeployment.Spec.DeploymentSpec.DiskSizeGB = intptr(20)
543543
createdDeployment.Spec.DeploymentSpec.AutoScaling = &mdbv1.AutoScalingSpec{
544-
AutoIndexingEnabled: boolptr(true),
545-
DiskGBEnabled: boolptr(true),
544+
DiskGBEnabled: boolptr(true),
546545
}
547546

548547
By(fmt.Sprintf("Creating the Deployment %s with autoscaling", kube.ObjectKeyFromObject(createdDeployment)), func() {

0 commit comments

Comments
 (0)