Skip to content

Commit 8b758fd

Browse files
committed
Set primary min replicas
1 parent 14369d8 commit 8b758fd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/controller/deployer.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ func (c *CanaryDeployer) createPrimaryDeployment(cd *flaggerv1.Canary) error {
378378
return err
379379
}
380380

381+
replicas := int32(1)
382+
if canaryDep.Spec.Replicas != nil && *canaryDep.Spec.Replicas > 0 {
383+
replicas = *canaryDep.Spec.Replicas
384+
}
385+
381386
// create primary deployment
382387
primaryDep = &appsv1.Deployment{
383388
ObjectMeta: metav1.ObjectMeta{
@@ -396,7 +401,7 @@ func (c *CanaryDeployer) createPrimaryDeployment(cd *flaggerv1.Canary) error {
396401
ProgressDeadlineSeconds: canaryDep.Spec.ProgressDeadlineSeconds,
397402
MinReadySeconds: canaryDep.Spec.MinReadySeconds,
398403
RevisionHistoryLimit: canaryDep.Spec.RevisionHistoryLimit,
399-
Replicas: canaryDep.Spec.Replicas,
404+
Replicas: int32p(replicas),
400405
Strategy: canaryDep.Spec.Strategy,
401406
Selector: &metav1.LabelSelector{
402407
MatchLabels: map[string]string{

0 commit comments

Comments
 (0)