-
Notifications
You must be signed in to change notification settings - Fork 205
fix: Supporting advanced_cluster
upgrade to dedicated with NMVe instance
#3549
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
base: master
Are you sure you want to change the base?
Conversation
This PR has gone 7 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 7 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy! |
advanced_cluster
upgrade to dedicated with NMVe instance
APIx bot: a message has been sent to Docs Slack channel |
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.
Pull Request Overview
This PR fixes an issue where upgrading advanced clusters from tenant (M0) or flex clusters to dedicated NVMe instances would fail due to missing backup configuration in the upgrade request.
- Adds
providerBackupEnabled
field to tenant upgrade requests when backup is enabled - Adds
backupEnabled
field to flex-to-dedicated upgrade requests when backup is enabled - Updates test configuration to use NVMe instance with backup enabled for tenant upgrade testing
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
internal/service/advancedclustertpf/resource_upgrade.go | Adds backup enabled logic to both tenant and flex upgrade request builders |
internal/service/advancedcluster/resource_advanced_cluster.go | Adds backup enabled logic to legacy tenant upgrade request builder |
internal/service/advancedcluster/model_flex.go | Adds backup enabled logic to flex-to-dedicated upgrade request builder |
internal/testutil/acc/advanced_cluster.go | Adds new test configuration for dedicated NVMe cluster with backup enabled |
internal/service/advancedcluster/resource_advanced_cluster_test.go | Updates tenant upgrade test to use NVMe configuration and adds validation checks |
internal/service/advancedcluster/testdata/TestAccMockableAdvancedCluster_tenantUpgrade/02_01_POST__api_atlas_v2_groups_{groupId}_clusters_tenantUpgrade_2023-01-01.json | Updates mock request to include backup enabled and NVMe instance size |
.changelog/3549.txt | Adds changelog entries for the bug fix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
ebs_volume_type = "PROVISIONED" | ||
node_count = 3 |
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.
The indentation is inconsistent. All three fields should use the same indentation level as the surrounding code.
ebs_volume_type = "PROVISIONED" | |
node_count = 3 | |
ebs_volume_type = "PROVISIONED" | |
node_count = 3 |
Copilot uses AI. Check for mistakes.
backupEnabled := state.BackupEnabled // a flex cluster can already have backup enabled | ||
if patch.BackupEnabled != nil { | ||
backupEnabled = patch.BackupEnabled | ||
} | ||
if backupEnabled != nil && *backupEnabled { |
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.
[nitpick] The backup enabled logic could be simplified. Consider using a more direct approach: if (state.GetBackupEnabled() || patch.GetBackupEnabled()) { req.BackupEnabled = conversion.Pointer(true) }
backupEnabled := state.BackupEnabled // a flex cluster can already have backup enabled | |
if patch.BackupEnabled != nil { | |
backupEnabled = patch.BackupEnabled | |
} | |
if backupEnabled != nil && *backupEnabled { | |
if state.GetBackupEnabled() || patch.GetBackupEnabled() { |
Copilot uses AI. Check for mistakes.
backupEnabled := state.BackupEnabled // a flex cluster can already have backup enabled | ||
if patch.BackupEnabled != nil { | ||
backupEnabled = patch.BackupEnabled | ||
} |
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.
Why not
req.BackupEnabled = backupEnabled
?
Or do we want to avoid setting it if it is false
?
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.
Would not make a difference, just thought of keeping the upgrade request compact for the regular cases
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.
LGTM!
Description
Link to any related issue(s): CLOUDP-321150
Problem
If a tenant upgrade wants to be done from M0 to an NMVe instance (e.g.
M40_NVME
) backup must be enabled. Our current implementation does not send backup enabled information in the tenant upgrade request.Solution
Include backup enabled information in tenant and flex upgrade requests to achieve a success upgrade if NMVe and backup is defined.
Example tenant upgrade request with NVMe and backup enabled is defined:
The following cases are considered:
Before (all cases failing)
After
TestAccMockableAdvancedCluster_tenantUpgrade
test.Cannot modify disk size for an NVMe cluster.
because computed diskSizeGB is sent as part of request.testAccAdvancedClusterFlexUpgrade
to always upgrade to an NVMe instance with backup.Type of change:
Required Checklist:
Further comments