Skip to content

Commit 72f2408

Browse files
authored
CLOUDP-323579: Add warning about using independentShardScaling flag (#3987)
1 parent 94057bb commit 72f2408

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

internal/cli/clusters/clusters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func isClusterWideScaling(mode string) bool {
204204
return strings.EqualFold(mode, clusterWideScalingFlag) || strings.EqualFold(mode, clusterWideScalingResponse)
205205
}
206206

207-
func detectIsFileISS(fs afero.Fs, filename string) string {
207+
func detectAutoScalingModeFromFile(fs afero.Fs, filename string) string {
208208
// First try to load as a default dedicated cluster in strict mode.
209209
// If it succeeds, it is a default dedicated cluster.
210210
oldCluster := new(atlasClustersPinned.AdvancedClusterDescription)

internal/cli/clusters/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ func (opts *CreateOpts) validateTier() error {
492492

493493
func (opts *CreateOpts) validateAutoScalingMode() error {
494494
if opts.isFlexCluster && !isClusterWideScaling(opts.autoScalingMode) {
495-
return fmt.Errorf("flex is incompatible with %s auto scaling mode", opts.autoScalingMode)
495+
return fmt.Errorf("flex is incompatible with %s auto scaling mode, set a --tier value different from FLEX, e.g. M10", opts.autoScalingMode)
496496
}
497497

498498
err := validate.AutoScalingMode(opts.autoScalingMode)()
@@ -505,7 +505,7 @@ func (opts *CreateOpts) validateAutoScalingMode() error {
505505
}
506506

507507
if opts.filename != "" {
508-
opts.autoScalingMode = detectIsFileISS(opts.fs, opts.filename)
508+
opts.autoScalingMode = detectAutoScalingModeFromFile(opts.fs, opts.filename)
509509
}
510510

511511
return nil

internal/cli/clusters/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ func (opts *UpdateOpts) validateTier() error {
318318

319319
func (opts *UpdateOpts) validateAutoScalingMode() error {
320320
if opts.filename != "" {
321-
opts.autoScalingMode = detectIsFileISS(opts.fs, opts.filename)
321+
opts.autoScalingMode = detectAutoScalingModeFromFile(opts.fs, opts.filename)
322322
}
323323

324324
return validate.AutoScalingMode(opts.autoScalingMode)()

internal/validate/validate.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ func AutoScalingMode(autoScalingMode string) func() error {
139139
if !strings.EqualFold(autoScalingMode, clusterWideScaling) && !strings.EqualFold(autoScalingMode, independentShardScaling) {
140140
return fmt.Errorf("invalid auto scaling mode: %s. Valid values are %s or %s", autoScalingMode, clusterWideScaling, independentShardScaling)
141141
}
142+
143+
if strings.EqualFold(autoScalingMode, independentShardScaling) {
144+
fmt.Fprintf(os.Stderr, "'independentShardScaling' autoscaling cluster detected, use --autoScalingMode independentShardScaling for clusters-related commands when interacting with this cluster")
145+
}
142146
return nil
143147
}
144148
}

0 commit comments

Comments
 (0)