-
Notifications
You must be signed in to change notification settings - Fork 106
CLOUDP-80765: Handle Cluster pause/unpause #89
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
Changes from all commits
78cb6db
f432351
6755c28
3b00aab
3cd01f8
5686ceb
ba12fab
8f88f60
6f60768
0c1d6d2
6146120
f3bf39c
fa78e81
110483f
3a1e0cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,7 +86,6 @@ var _ = Describe("AtlasCluster", func() { | |
| ))) | ||
| Expect(createdCluster.Status.ObservedGeneration).To(Equal(createdCluster.Generation)) | ||
| Expect(createdCluster.Status.ObservedGeneration).To(Equal(lastGeneration + 1)) | ||
| lastGeneration++ | ||
| }) | ||
| } | ||
|
|
||
|
|
@@ -116,7 +115,7 @@ var _ = Describe("AtlasCluster", func() { | |
| Eventually(testutil.WaitFor(k8sClient, createdCluster, status.TrueCondition(status.ReadyType), validateClusterUpdatingFunc()), | ||
| 1200, interval).Should(BeTrue()) | ||
|
|
||
| doCommonChecks() | ||
| lastGeneration++ | ||
| } | ||
|
|
||
| Describe("Create/Update the cluster", func() { | ||
|
|
@@ -139,12 +138,14 @@ var _ = Describe("AtlasCluster", func() { | |
| By("Updating the Cluster labels", func() { | ||
| createdCluster.Spec.Labels = []mdbv1.LabelSpec{{Key: "int-test", Value: "true"}} | ||
| performUpdate() | ||
| doCommonChecks() | ||
| checkAtlasState() | ||
| }) | ||
|
|
||
| By("Updating the Cluster backups settings", func() { | ||
| createdCluster.Spec.ProviderBackupEnabled = boolptr(true) | ||
| performUpdate() | ||
| doCommonChecks() | ||
| checkAtlasState(func(c *mongodbatlas.Cluster) { | ||
| Expect(c.ProviderBackupEnabled).To(Equal(createdCluster.Spec.ProviderBackupEnabled)) | ||
| }) | ||
|
|
@@ -153,13 +154,52 @@ var _ = Describe("AtlasCluster", func() { | |
| By("Decreasing the Cluster disk size", func() { | ||
| createdCluster.Spec.DiskSizeGB = intptr(10) | ||
| performUpdate() | ||
| doCommonChecks() | ||
| checkAtlasState(func(c *mongodbatlas.Cluster) { | ||
| Expect(*c.DiskSizeGB).To(BeEquivalentTo(*createdCluster.Spec.DiskSizeGB)) | ||
|
|
||
| // check whether https://github.com/mongodb/go-client-mongodb-atlas/issues/140 is fixed | ||
| Expect(c.DiskSizeGB).To(BeAssignableToTypeOf(float64ptr(0)), "DiskSizeGB is no longer a *float64, please check the spec!") | ||
| }) | ||
| }) | ||
|
|
||
| By("Pausing the cluster", func() { | ||
| createdCluster.Spec.Paused = boolptr(true) | ||
| performUpdate() | ||
| doCommonChecks() | ||
| checkAtlasState(func(c *mongodbatlas.Cluster) { | ||
| Expect(c.Paused).To(Equal(createdCluster.Spec.Paused)) | ||
| }) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we check that after the cluster paused/unpaused - the following updates to the other fields can be done?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Atlas does not support updates on paused clusters:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, thanks for this clarification.
WDYT about testing the above scenario or maybe you'll find a better scenario to check
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The cluster will be in a non-ready state because such updates will fail on Atlas' side. I'm not sure whether we want to make it "ready" in this scenario though...
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as discussed p2p having the cluster as "not ready" is a correct outcome 👍 This is something we can confirm with the test |
||
| }) | ||
|
|
||
| By("Updating the Cluster configuration while paused (should fail)", func() { | ||
| createdCluster.Spec.ProviderBackupEnabled = boolptr(false) | ||
|
|
||
| Expect(k8sClient.Update(context.Background(), createdCluster)).To(Succeed()) | ||
| Eventually( | ||
| testutil.WaitFor(k8sClient, createdCluster, status.FalseCondition(status.ClusterReadyType).WithReason(string(workflow.ClusterNotCreatedInAtlas))), | ||
| 60, | ||
| interval, | ||
| ).Should(BeTrue()) | ||
|
|
||
| lastGeneration++ | ||
| }) | ||
|
|
||
| By("Unpausing the cluster", func() { | ||
| createdCluster.Spec.Paused = boolptr(false) | ||
| performUpdate() | ||
| doCommonChecks() | ||
| checkAtlasState(func(c *mongodbatlas.Cluster) { | ||
| Expect(c.Paused).To(Equal(createdCluster.Spec.Paused)) | ||
| }) | ||
| }) | ||
|
|
||
| By("Checking that modifications were applied after unpausing", func() { | ||
| doCommonChecks() | ||
| checkAtlasState(func(c *mongodbatlas.Cluster) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we also check that the AtlasCluster has now all status conditions set to true? |
||
| Expect(c.ProviderBackupEnabled).To(Equal(createdCluster.Spec.ProviderBackupEnabled)) | ||
| }) | ||
| }) | ||
| }) | ||
| }) | ||
| }) | ||
|
|
@@ -197,7 +237,7 @@ func validateClusterUpdatingFunc() func(a mdbv1.AtlasCustomResource) { | |
| } | ||
| // When the create request has been made to Atlas - we expect the following status | ||
| if !isIdle { | ||
| Expect(c.Status.StateName).To(Equal("UPDATING"), fmt.Sprintf("Current conditions: %+v", c.Status.Conditions)) | ||
| Expect(c.Status.StateName).To(Or(Equal("UPDATING"), Equal("REPAIRING")), fmt.Sprintf("Current conditions: %+v", c.Status.Conditions)) | ||
| expectedConditionsMatchers := testutil.MatchConditions( | ||
| status.FalseCondition(status.ClusterReadyType).WithReason(string(workflow.ClusterUpdating)).WithMessageRegexp("cluster is updating"), | ||
| status.FalseCondition(status.ReadyType), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting! Will this update the
pausedin Atlas to nil as well? How does Atlas interpret paused as nil - may it start the cluster back?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omitemptyin JSON spec means thatnilis not included in the payload, so no changes will be madeDocs:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the information, I think this should be safe 👍