Skip to content

Conversation

@vasilevp
Copy link
Contributor

@vasilevp vasilevp commented Feb 5, 2021

No description provided.

@vasilevp vasilevp self-assigned this Feb 5, 2021
@vasilevp vasilevp marked this pull request as draft February 5, 2021 11:57
@vasilevp vasilevp marked this pull request as ready for review February 8, 2021 08:54
Copy link
Contributor

@antonlisovenko antonlisovenko left a comment

Choose a reason for hiding this comment

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

Interesting logic with nullifying 'paused' and performing a one-time change request.
Looks good, the only suggestion is to add update requests after pause/unpause to make sure that the explicit nullyfing the field hasn't affected anything in atlas

performUpdate()
checkAtlasState(func(c *mongodbatlas.Cluster) {
Expect(c.Paused).To(Equal(createdCluster.Spec.Paused))
})
Copy link
Contributor

Choose a reason for hiding this comment

The 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?
Also I guess we need to make sure that those updates don't change the cluster in Atlas (paused/unpaused) back to nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Atlas does not support updates on paused clusters:

You cannot modify a paused cluster other than to resume the cluster. Nor can you pause a cluster with pending changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, thanks for this clarification.
Then I guess the following behavior is expected?

  • the user updates "paused: true"
  • then the user changes other fields in the spec, controller sends this to Atlas but no changes happen there as the cluster is paused? The AtlasCluster resource is in "ready: true" state though?
  • then the user updates "pause: false" and the changes done in the previous step reach Atlas now?

WDYT about testing the above scenario or maybe you'll find a better scenario to check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

then the user changes other fields in the spec, controller sends this to Atlas but no changes happen there as the cluster is paused? The AtlasCluster resource is in "ready: true" state though?

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...

Copy link
Contributor

Choose a reason for hiding this comment

The 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

}
} else {
// otherwise, don't send the paused field
spec.Paused = nil
Copy link
Contributor

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 paused in Atlas to nil as well? How does Atlas interpret paused as nil - may it start the cluster back?

Copy link
Contributor Author

@vasilevp vasilevp Feb 8, 2021

Choose a reason for hiding this comment

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

omitempty in JSON spec means that nil is not included in the payload, so no changes will be made
Docs:

You do not need to provide all parameters when modifying a cluster, only the parameters you want to change and any parameters required to make that change.

Copy link
Contributor

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 👍

Copy link
Contributor

@antonlisovenko antonlisovenko left a comment

Choose a reason for hiding this comment

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

Thanks for the test, just an additional check in the test and should be ready to go!

})

By("Checking that modifications were applied after unpausing", func() {
checkAtlasState(func(c *mongodbatlas.Cluster) {
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

@vasilevp vasilevp merged commit 0555f81 into main Feb 10, 2021
@vasilevp vasilevp deleted the CLOUDP-80765-cluster-pause branch February 10, 2021 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants