Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDP-130483: Fixed diskSizeGB decreasing #634

Merged
merged 6 commits into from Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions pkg/controller/atlasdeployment/deployment.go
Expand Up @@ -133,10 +133,6 @@ func removeOutdatedFields(removeFrom *mongodbatlas.Cluster, lookAt *mongodbatlas
} else {
result.ProviderSettings.AutoScaling.Compute = &mongodbatlas.Compute{}
}

if lookAt.AutoScaling.DiskGBEnabled != nil && *lookAt.AutoScaling.DiskGBEnabled {
Copy link
Contributor

@yzdann yzdann Aug 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @igor-karpukhin,
Are you changing the whole concept of the operator should not touch disk/instance size if autoscaling is enabled? (#322)

For example, we have a deploymentA(Kubernetes object) with a 10GB disk, and disk autoscaling is enabled.
After some time, autoscaler on the Atlas platform decided to increase the disk size to 15GB, the increasing process is finished and now our atlas cluster has a 15GB disk.
What value should we expect in the Kubernetes object related to that deploymentA 10GB or 15GB?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API technically allows disk size to be configured with autoscaling enabled. But, I just revert it to the previous state so it's not configurable if the autoscaling is enabled.

result.DiskSizeGB = nil
}
}

return result
Expand Down
32 changes: 31 additions & 1 deletion test/int/deployment_test.go
Expand Up @@ -460,6 +460,36 @@ var _ = Describe("AtlasDeployment", Label("int", "AtlasDeployment"), func() {
})
})

It("Should Success (AWS) with enabled autoscaling", func() {
createdDeployment = mdbv1.DefaultAWSDeployment(namespace.Name, createdProject.Name)
createdDeployment.Spec.DeploymentSpec.AutoScaling = &mdbv1.AutoScalingSpec{
AutoIndexingEnabled: boolptr(true),
DiskGBEnabled: boolptr(true),
}

By(fmt.Sprintf("Creating the Deployment %s with autoscaling", kube.ObjectKeyFromObject(createdDeployment)), func() {
Expect(k8sClient.Create(context.Background(), createdDeployment)).ToNot(HaveOccurred())

Eventually(testutil.WaitFor(k8sClient, createdDeployment, status.TrueCondition(status.ReadyType), validateDeploymentCreatingFunc()),
DeploymentUpdateTimeout, interval).Should(BeTrue())

doRegularDeploymentStatusChecks()
checkAtlasState()
})

By("Decreasing the Deployment disk size", func() {
createdDeployment.Spec.DeploymentSpec.DiskSizeGB = intptr(12)
performUpdate(20 * time.Minute)
doRegularDeploymentStatusChecks()
checkAtlasState(func(c *mongodbatlas.Cluster) {
Expect(*c.DiskSizeGB).To(BeEquivalentTo(*createdDeployment.Spec.DeploymentSpec.DiskSizeGB))

// check whether https://github.com/mongodb/go-client-mongodb-atlas/issues/140 is fixed
Sugar-pack marked this conversation as resolved.
Show resolved Hide resolved
Expect(c.DiskSizeGB).To(BeAssignableToTypeOf(float64ptr(0)), "DiskSizeGB is no longer a *float64, please check the spec!")
})
})
})

It("Should Succeed (AWS)", func() {
createdDeployment = mdbv1.DefaultAWSDeployment(namespace.Name, createdProject.Name)

Expand Down Expand Up @@ -490,7 +520,7 @@ var _ = Describe("AtlasDeployment", Label("int", "AtlasDeployment"), func() {
})

By("Decreasing the Deployment disk size", func() {
createdDeployment.Spec.DeploymentSpec.DiskSizeGB = intptr(10)
createdDeployment.Spec.DeploymentSpec.DiskSizeGB = intptr(15)
fabritsius marked this conversation as resolved.
Show resolved Hide resolved
performUpdate(20 * time.Minute)
doRegularDeploymentStatusChecks()
checkAtlasState(func(c *mongodbatlas.Cluster) {
Expand Down