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

feat: Supports config_server_type and config_server_management_mode in advanced_cluster #2670

Merged
merged 9 commits into from
Oct 14, 2024

Conversation

EspenAlbert
Copy link
Collaborator

@EspenAlbert EspenAlbert commented Oct 9, 2024

Description

Link to any related issue(s): CLOUDP-228611

Doc updates done in #2677

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals I have added appropriate changelog entries.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

} else if d.HasChange("replica_set_scaling_strategy") || d.HasChange("redact_client_log_data") {
waitOnUpdate = true
}
if d.HasChange("replica_set_scaling_strategy") || d.HasChange("redact_client_log_data") || d.HasChange("config_server_management_mode") {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fix: supports updating both old cluster attributes and new attributes when using old SDK

if _, _, err := connV2.ClustersApi.UpdateCluster(ctx, projectID, clusterName, request).Execute(); err != nil {
return diag.FromErr(fmt.Errorf(errorUpdate, clusterName, err))
}
waitOnUpdate = true
}
if waitOnUpdate {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

use waitOnUpdateToFinish at the end instead of doing it twice inside each if

@@ -555,12 +560,12 @@ func TestAccClusterAdvancedClusterConfig_symmetricShardedOldSchema(t *testing.T)
CheckDestroy: acc.CheckDestroyCluster,
Steps: []resource.TestStep{
{
Config: configShardedOldSchemaMultiCloud(orgID, projectName, clusterName, 2, "M10"),
Check: checkShardedOldSchemaMultiCloud(clusterName, 2, "M10", false),
Config: configShardedOldSchemaMultiCloud(orgID, projectName, clusterName, 2, "M10", &configServerManagementModeFixedToDedicated),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. Choosing to only test for the old schema as there is extra logic there.
  2. Choosing to re-use existing test as we need a sharded cluster (also picked a test without migration tests since we are introducing a new field)

@EspenAlbert EspenAlbert marked this pull request as ready for review October 10, 2024 12:58
@EspenAlbert EspenAlbert requested review from a team as code owners October 10, 2024 12:58
Copy link
Contributor

APIx bot: a message has been sent to Docs Slack channel

Copy link
Contributor

@kyuan-mongodb kyuan-mongodb left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -0,0 +1,11 @@
```release-note:enhancement
resource/mongodbatlas_advanced_cluster: Adds new `config_server_management_mode` and `config_server_type` fields
Copy link
Member

Choose a reason for hiding this comment

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

knit: I think it's ok although in other occasions we've added a line per field

Copy link
Member

@AgustinBettati AgustinBettati left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 769 to 770
if cluster.ConfigServerManagementMode != nil {
if err := d.Set("config_server_management_mode", *cluster.ConfigServerManagementMode); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

can we simplify this by using SDK getter functions? Same for above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You were right. Changed in c38307c
I thought we didn't want to update state when the user hasn't set those fields before

Comment on lines +1196 to +1197
mongo_db_major_version = "8"
config_server_management_mode = %[1]q
Copy link
Member

Choose a reason for hiding this comment

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

should we clarify in docs that this attribute requires mongodb version > 8 and cluster must be sharded?

Copy link
Collaborator Author

@EspenAlbert EspenAlbert Oct 11, 2024

Choose a reason for hiding this comment

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

You can find the doc updates here: #2677 it mentions sharded.
About version > 8, that is only for embedded, so the field is still valid on earlier versions but it will always be direct.

EspenAlbert and others added 3 commits October 11, 2024 10:34
…nd `config_server_type` (#2677)

* chore: add docs for `config_server_management_mode` and `config_server_type`

* Update docs/data-sources/advanced_cluster.md

Co-authored-by: kyuan-mongodb <[email protected]>

* Update docs/data-sources/advanced_clusters.md

Co-authored-by: kyuan-mongodb <[email protected]>

* Update docs/resources/advanced_cluster.md

Co-authored-by: kyuan-mongodb <[email protected]>

---------

Co-authored-by: kyuan-mongodb <[email protected]>
@EspenAlbert EspenAlbert merged commit a0be718 into master Oct 14, 2024
38 checks passed
@EspenAlbert EspenAlbert deleted the CLOUDP-228611_adv_cluster_sharded_embedded_config branch October 14, 2024 15:09
svc-apix-Bot added a commit that referenced this pull request Oct 14, 2024
lantoli added a commit that referenced this pull request Oct 16, 2024
* master: (44 commits)
  Remove RemoveResource from Create and Update (#2694)
  sleep first time only (#2696)
  fix: Ensures event_trigger `disabled` is included in the PUT payload (#2690)
  chore: Bump srvaroa/labeler from 1.11.0 to 1.11.1 (#2695)
  build(deps): bump go.mongodb.org/atlas-sdk (#2686)
  fix: Avoids setting organization id to empty when the USER_IS_NOT_FOUND (#2684)
  doc: Corrects default value of `auto_scaling_disk_gb_enabled` (#2683)
  chore: Reminder to log test failures (#2688)
  chore: Updates CHANGELOG.md for #2670
  feat: Supports `config_server_type` and `config_server_management_mode` in advanced_cluster (#2670)
  chore: Creates `advancedclustertpf` package for new implementation (#2679)
  chore: Removes deprecation warnings for `labels` in cluster/adv_cluster (#2678)
  doc: Adjusts `redact_client_log_data` doc (#2676)
  chore: Adds sleep in tests to avoid out of capacity errors (#2674)
  refactor: Adjust type of set structure in team update logic (#2675)
  chore: Updates CHANGELOG.md header for v1.21.1 release
  chore: Updates examples link in index.md for v1.21.1 release
  build(deps): bump go.mongodb.org/atlas-sdk (#2672)
  doc: Fixes Public -> Private Preview and adds contact link. (#2671)
  chore: Updates CHANGELOG.md for #2669
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants