fix(compose): remove ServiceSpec validation for 0 replicas, it's handled when resolving defaults

This commit is contained in:
Pavel Sviderski
2025-03-27 20:40:11 +10:00
parent 1911e03c82
commit 3893005866
-5
View File
@@ -125,11 +125,6 @@ func (d *Deployment) Validate(ctx context.Context) error {
if mode != d.Service.Mode { if mode != d.Service.Mode {
return errors.New("service mode cannot be changed") return errors.New("service mode cannot be changed")
} }
if mode == api.ServiceModeReplicated && d.Spec.Replicas < 1 {
// Scaling down to zero is not allowed as this would effectively remove the service without preserving
// its configuration, making it impossible to scale back up.
return errors.New("number of replicas must be at least 1")
}
return nil return nil
} }