diff --git a/internal/controller/operator/factory/vmagent/vmagent.go b/internal/controller/operator/factory/vmagent/vmagent.go index b16538652..27d20c1a0 100644 --- a/internal/controller/operator/factory/vmagent/vmagent.go +++ b/internal/controller/operator/factory/vmagent/vmagent.go @@ -190,13 +190,14 @@ func createOrUpdateApp(ctx context.Context, rclient client.Client, cr, prevCR *v shardCount := cr.GetShardCount() prevShardCount := prevCR.GetShardCount() - isUpscaling := false + isUpscaling := prevShardCount < shardCount if prevCR.IsSharded() { - if prevShardCount < shardCount { - logger.WithContext(ctx).Info(fmt.Sprintf("VMAgent shard upscaling from=%d to=%d", prevShardCount, shardCount)) - isUpscaling = true - } else { - logger.WithContext(ctx).Info(fmt.Sprintf("VMAgent shard downscaling from=%d to=%d", prevShardCount, shardCount)) + if prevShardCount != shardCount { + action := "downscaling" + if isUpscaling { + action = "upscaling" + } + logger.WithContext(ctx).Info(fmt.Sprintf("VMAgent shard %s from=%d to=%d", action, prevShardCount, shardCount)) } } diff --git a/internal/controller/operator/factory/vmanomaly/statefulset.go b/internal/controller/operator/factory/vmanomaly/statefulset.go index 3d94c9931..affe53c15 100644 --- a/internal/controller/operator/factory/vmanomaly/statefulset.go +++ b/internal/controller/operator/factory/vmanomaly/statefulset.go @@ -176,13 +176,14 @@ func createOrUpdateApp(ctx context.Context, rclient client.Client, cr, prevCR *v shardCount := cr.GetShardCount() prevShardCount := prevCR.GetShardCount() - isUpscaling := false + isUpscaling := prevShardCount < shardCount if prevCR.IsSharded() { - if prevShardCount < shardCount { - logger.WithContext(ctx).Info(fmt.Sprintf("%T shard upscaling from=%d to=%d", cr, prevShardCount, shardCount)) - isUpscaling = true - } else { - logger.WithContext(ctx).Info(fmt.Sprintf("%T shard downscaling from=%d to=%d", cr, prevShardCount, shardCount)) + if prevShardCount != shardCount { + action := "downscaling" + if isUpscaling { + action = "upscaling" + } + logger.WithContext(ctx).Info(fmt.Sprintf("VMAnomaly shard %s from=%d to=%d", action, prevShardCount, shardCount)) } }