Skip to content

Conversation

@andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo commented Dec 16, 2024

Ticket: CLOUDP-285946

Proposed changes

This PR updates the atlas cluster upgrade logic to support upgrading a flex cluster to a dedicated one.

Flex Cluster
./bin/atlas cluster upgrade ClusterFlex2 --tier M10 -P prod                                                                       
Upgrading cluster 'ClusterFlex2'.
./bin/atlas cluster upgrade ClusterFlex222 --tier M10 --diskSizeGB 10 -P prod -o json                                                   
{
  "backupSettings": {
    "enabled": true
  },
  "clusterType": "REPLICASET",
  "connectionStrings": {
    "standard": "mongodb://ac-f7csao4-shard-00-00.b4hi8py.mongodb.net:27017,ac-f7csao4-shard-00-01.b4hi8py.mongodb.net:27017,ac-f7csao4-shard-00-02.b4hi8py.mongodb.net:27017/?ssl=true\u0026authSource=admin\u0026replicaSet=atlas-evgy47-shard-0",
    "standardSrv": "mongodb+srv://clusterflex222.b4hi8py.mongodb.net"
  },
  "createDate": "2024-12-16T16:17:58Z",
  "groupId": "663268874ddd3b236fd2f107",
  "id": "676052b637faaf599e449c57",
  "mongoDBVersion": "8.0.3",
  "name": "ClusterFlex222",
  "providerSettings": {
    "backingProviderName": "AWS",
    "diskSizeGB": 5,
    "providerName": "FLEX",
    "regionName": "EU_WEST_1"
  },
  "stateName": "UPDATING",
  "tags": [],
  "terminationProtectionEnabled": false,
  "versionReleaseSystem": "LTS"
}

Using --file flag

./bin/atlas cluster upgrade ClusterFlex1 --file cluster_upgrade_m0.json  -P prod -o json                                             
{
  "backupSettings": {
    "enabled": true
  },
  "clusterType": "REPLICASET",
  "connectionStrings": {
    "standard": "mongodb://ac-qr8tvkf-shard-00-00.be5xwl3.mongodb.net:27017,ac-qr8tvkf-shard-00-01.be5xwl3.mongodb.net:27017,ac-qr8tvkf-shard-00-02.be5xwl3.mongodb.net:27017/?ssl=true\u0026authSource=admin\u0026replicaSet=atlas-l42q3a-shard-0",
    "standardSrv": "mongodb+srv://clusterflex1.be5xwl3.mongodb.net"
  },
  "createDate": "2024-12-16T17:00:35Z",
  "groupId": "663268874ddd3b236fd2f107",
  "id": "67605cb33547de5776114321",
  "mongoDBVersion": "8.0.3",
  "name": "ClusterFlex1",
  "providerSettings": {
    "backingProviderName": "AWS",
    "diskSizeGB": 5,
    "providerName": "FLEX",
    "regionName": "EU_WEST_1"
  },
  "stateName": "UPDATING",
  "tags": [],
  "terminationProtectionEnabled": false,
  "versionReleaseSystem": "LTS"
}
M0 Cluster
./bin/atlas cluster upgrade ClusterM0 --tier M10 --diskSizeGB 10 -P prod -o json                                                        
{
  "autoScaling": {
    "compute": {
      "enabled": false,
      "scaleDownEnabled": false
    },
    "diskGBEnabled": false
  },
  "backupEnabled": false,
  "biConnector": {
    "enabled": false,
    "readPreference": "secondary"
  },
  "clusterType": "REPLICASET",
  "diskSizeGB": 0.5,
  "encryptionAtRestProvider": "NONE",
  "id": "67597df800619d37a309ca57",
  "groupId": "663268874ddd3b236fd2f107",
  "mongoDBVersion": "8.0.3",
  "mongoDBMajorVersion": "8.0",
  "mongoURI": "mongodb://clusterm0-shard-00-00.pkura.mongodb.net:27017,clusterm0-shard-00-01.pkura.mongodb.net:27017,clusterm0-shard-00-02.pkura.mongodb.net:27017",
  "mongoURIUpdated": "2024-12-11T11:58:02Z",
  "mongoURIWithOptions": "mongodb://clusterm0-shard-00-00.pkura.mongodb.net:27017,clusterm0-shard-00-01.pkura.mongodb.net:27017,clusterm0-shard-00-02.pkura.mongodb.net:27017/?ssl=true\u0026authSource=admin\u0026replicaSet=atlas-j1y0np-shard-0",
  "name": "ClusterM0",
  "createDate": "2024-12-11T11:56:40Z",
  "numShards": 1,
  "paused": false,
  "pitEnabled": false,
  "providerBackupEnabled": false,
  "providerSettings": {
    "backingProviderName": "AWS",
    "instanceSizeName": "M0",
    "providerName": "TENANT",
    "regionName": "EU_WEST_1",
    "autoScaling": {
      "compute": {}
    }
  },
  "replicationFactor": 3,
  "replicationSpec": {
    "EU_WEST_1": {
      "analyticsNodes": 0,
      "electableNodes": 3,
      "priority": 7,
      "readOnlyNodes": 0
    }
  },
  "replicationSpecs": [
    {
      "id": "67597df800619d37a309ca32",
      "numShards": 1,
      "zoneName": "Zone 1",
      "regionsConfig": {
        "EU_WEST_1": {
          "analyticsNodes": 0,
          "electableNodes": 3,
          "priority": 7,
          "readOnlyNodes": 0
        }
      }
    }
  ],
  "srvAddress": "mongodb+srv://clusterm0.pkura.mongodb.net",
  "stateName": "UPDATING",
  "connectionStrings": {
    "standard": "mongodb://clusterm0-shard-00-00.pkura.mongodb.net:27017,clusterm0-shard-00-01.pkura.mongodb.net:27017,clusterm0-shard-00-02.pkura.mongodb.net:27017/?ssl=true\u0026authSource=admin\u0026replicaSet=atlas-j1y0np-shard-0",
    "standardSrv": "mongodb+srv://clusterm0.pkura.mongodb.net"
  },
  "links": [
    {
      "rel": "self",
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/663268874ddd3b236fd2f107/clusters/ClusterM0"
    },
    {
      "rel": "https://cloud.mongodb.com/restoreJobs",
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/663268874ddd3b236fd2f107/clusters/ClusterM0/backup/restoreJobs"
    },
    {
      "rel": "https://cloud.mongodb.com/snapshots",
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/663268874ddd3b236fd2f107/clusters/ClusterM0/backup/snapshots"
    }
  ],
  "versionReleaseSystem": "LTS",
  "rootCertType": "ISRGROOTX1",
  "terminationProtectionEnabled": false,
  "tags": []
}

Using --file flag

 ./bin/atlas cluster upgrade ClusterM0 --file cluster_upgrade_m0.json  -P prod -o json                                               
{
  "autoScaling": {
    "compute": {
      "enabled": false,
      "scaleDownEnabled": false
    },
    "diskGBEnabled": false
  },
  "backupEnabled": false,
  "biConnector": {
    "enabled": false,
    "readPreference": "secondary"
  },
  "clusterType": "REPLICASET",
  "diskSizeGB": 0.5,
  "encryptionAtRestProvider": "NONE",
  "id": "676056982c87934cecb1b161",
  "groupId": "663268874ddd3b236fd2f107",
  "mongoDBVersion": "8.0.3",
  "mongoDBMajorVersion": "8.0",
  "mongoURI": "mongodb://clusterm0-shard-00-00.pkura.mongodb.net:27017,clusterm0-shard-00-01.pkura.mongodb.net:27017,clusterm0-shard-00-02.pkura.mongodb.net:27017",
  "mongoURIUpdated": "2024-12-16T16:36:21Z",
  "mongoURIWithOptions": "mongodb://clusterm0-shard-00-00.pkura.mongodb.net:27017,clusterm0-shard-00-01.pkura.mongodb.net:27017,clusterm0-shard-00-02.pkura.mongodb.net:27017/?ssl=true\u0026authSource=admin\u0026replicaSet=atlas-j1y0np-shard-0",
  "name": "ClusterM0",
  "createDate": "2024-12-16T16:34:32Z",
  "numShards": 1,
  "paused": false,
  "pitEnabled": false,
  "providerBackupEnabled": false,
  "providerSettings": {
    "backingProviderName": "AWS",
    "instanceSizeName": "M0",
    "providerName": "TENANT",
    "regionName": "EU_WEST_1",
    "autoScaling": {
      "compute": {}
    }
  },
  "replicationFactor": 3,
  "replicationSpec": {
    "EU_WEST_1": {
      "analyticsNodes": 0,
      "electableNodes": 3,
      "priority": 7,
      "readOnlyNodes": 0
    }
  },
  "replicationSpecs": [
    {
      "id": "67605692726aaf06197bbe72",
      "numShards": 1,
      "zoneName": "Zone 1",
      "regionsConfig": {
        "EU_WEST_1": {
          "analyticsNodes": 0,
          "electableNodes": 3,
          "priority": 7,
          "readOnlyNodes": 0
        }
      }
    }
  ],
  "srvAddress": "mongodb+srv://clusterm0.pkura.mongodb.net",
  "stateName": "UPDATING",
  "connectionStrings": {
    "standard": "mongodb://clusterm0-shard-00-00.pkura.mongodb.net:27017,clusterm0-shard-00-01.pkura.mongodb.net:27017,clusterm0-shard-00-02.pkura.mongodb.net:27017/?ssl=true\u0026authSource=admin\u0026replicaSet=atlas-j1y0np-shard-0",
    "standardSrv": "mongodb+srv://clusterm0.pkura.mongodb.net"
  },
  "links": [
    {
      "rel": "self",
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/663268874ddd3b236fd2f107/clusters/ClusterM0"
    },
    {
      "rel": "https://cloud.mongodb.com/restoreJobs",
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/663268874ddd3b236fd2f107/clusters/ClusterM0/backup/restoreJobs"
    },
    {
      "rel": "https://cloud.mongodb.com/snapshots",
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/663268874ddd3b236fd2f107/clusters/ClusterM0/backup/snapshots"
    }
  ],
  "versionReleaseSystem": "LTS",
  "rootCertType": "ISRGROOTX1",
  "terminationProtectionEnabled": false,
  "tags": []
}

Evergreen path

https://evergreen.mongodb.com/version/67605f2c78127c0007aaf5b7

Next steps

  • add e2e tests

@andreaangiolillo andreaangiolillo marked this pull request as ready for review December 16, 2024 17:29
@andreaangiolillo andreaangiolillo requested a review from a team as a code owner December 16, 2024 17:29
Copy link
Collaborator

@cveticm cveticm left a comment

Choose a reason for hiding this comment

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

LGTM!

@andreaangiolillo andreaangiolillo merged commit 4ae6db1 into CLOUDP-287238_flex_cluster_feature_branch Dec 19, 2024
16 checks passed
@andreaangiolillo andreaangiolillo deleted the CLOUDP-285946_2 branch December 19, 2024 10:42
@apix-bot
Copy link
Contributor

apix-bot bot commented Dec 19, 2024

Coverage Report 📈

Branch Commit Coverage
CLOUDP-287238_flex_cluster_feature_branch d6757e0 38.6%
CLOUDP-285946_2 c17afb9 38.7%
Difference .1%

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.

4 participants