Skip to content

Commit 80b245d

Browse files
authored
fix: actual number of replicas in sharding rollout status (#9937)
1 parent 47a06ab commit 80b245d

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

controllers/apps/rollout/transformer_rollout_replace.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,11 @@ func replaceShardingReplicas(rollout *appsv1alpha1.Rollout, sharding appsv1alpha
471471
replicas := spec.Template.Replicas
472472
for _, status := range rollout.Status.Shardings {
473473
if status.Name == sharding.Name {
474-
replicas = status.Replicas
474+
if spec.Shards == 0 {
475+
replicas = 0
476+
} else {
477+
replicas = status.Replicas / spec.Shards
478+
}
475479
break
476480
}
477481
}

controllers/apps/rollout/transformer_rollout_setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func (t *rolloutSetupTransformer) initShardingStatus(transCtx *rolloutTransformC
196196
ShardingDef: spec.ShardingDef,
197197
ServiceVersion: spec.Template.ServiceVersion,
198198
CompDef: spec.Template.ComponentDef,
199-
Replicas: spec.Template.Replicas,
199+
Replicas: spec.Template.Replicas * spec.Shards,
200200
})
201201
return nil
202202
}

0 commit comments

Comments
 (0)