Skip to content

Commit ca42e6c

Browse files
authored
CLOUDP-222794: check isTenant on cluster upgrade (#2556)
1 parent 5708be1 commit ca42e6c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

internal/cli/atlas/clusters/upgrade.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,11 @@ func (opts *UpgradeOpts) patchOpts(out *atlas.Cluster) {
9595
if opts.diskSizeGB > 0 {
9696
out.DiskSizeGB = &opts.diskSizeGB
9797
}
98-
if opts.tier != "" && out.ProviderSettings != nil {
99-
out.ProviderSettings.InstanceSizeName = opts.tier
100-
if opts.tier == atlasM2 || opts.tier == atlasM5 {
98+
if out.ProviderSettings != nil {
99+
if opts.tier != "" {
100+
out.ProviderSettings.InstanceSizeName = opts.tier
101+
}
102+
if isTenant(out.ProviderSettings.InstanceSizeName) {
101103
out.BiConnector = nil
102104
} else {
103105
out.ProviderSettings.ProviderName = out.ProviderSettings.BackingProviderName
@@ -121,6 +123,12 @@ func (opts *UpgradeOpts) patchOpts(out *atlas.Cluster) {
121123
out.Tags = &tags
122124
}
123125

126+
func isTenant(instanceSizeName string) bool {
127+
return instanceSizeName == atlasM0 ||
128+
instanceSizeName == atlasM2 ||
129+
instanceSizeName == atlasM5
130+
}
131+
124132
// UpgradeBuilder atlas cluster(s) upgrade [clusterName] --projectId projectId [--tier M#] [--diskSizeGB N] [--mdbVersion] [--tag key=value].
125133
func UpgradeBuilder() *cobra.Command {
126134
opts := UpgradeOpts{

0 commit comments

Comments
 (0)