|
22 | 22 | ) |
23 | 23 | from dstack._internal.core.models.configurations import ( |
24 | 24 | DEFAULT_REPLICA_GROUP_NAME, |
| 25 | + SERVICE_HTTPS_DEFAULT, |
25 | 26 | ServiceConfiguration, |
26 | 27 | ) |
27 | 28 | from dstack._internal.core.models.gateways import GatewayConfiguration, GatewayStatus |
@@ -240,11 +241,13 @@ def _register_service_in_server(run_model: RunModel, run_spec: RunSpec) -> Servi |
240 | 241 | "Service with SGLang router configuration requires a gateway. " |
241 | 242 | "Please configure a gateway with the SGLang router enabled." |
242 | 243 | ) |
243 | | - if run_spec.configuration.https is False: |
244 | | - # Note: if the user sets `https: <default-value>`, it will be ignored silently |
245 | | - # TODO: in 0.19, make `https` Optional to be able to tell if it was set or omitted |
| 244 | + if run_spec.configuration.https not in ( |
| 245 | + None, |
| 246 | + "auto", |
| 247 | + True, # Default set by pre-0.20.12 clients. TODO(0.21.0?): forbid True too. |
| 248 | + ): |
246 | 249 | raise ServerClientError( |
247 | | - "The `https` configuration property is not applicable when running services without a gateway." |
| 250 | + f"Setting `https: {run_spec.configuration.https}` is not allowed without a gateway." |
248 | 251 | " Please configure a gateway or remove the `https` property from the service configuration" |
249 | 252 | ) |
250 | 253 | # Check if any group has autoscaling (min != max) |
@@ -416,6 +419,8 @@ async def unregister_replica(session: AsyncSession, job_model: JobModel): |
416 | 419 | def _get_service_https(run_spec: RunSpec, configuration: GatewayConfiguration) -> bool: |
417 | 420 | assert run_spec.configuration.type == "service" |
418 | 421 | https = run_spec.configuration.https |
| 422 | + if https is None: |
| 423 | + https = SERVICE_HTTPS_DEFAULT |
419 | 424 | if https == "auto": |
420 | 425 | if configuration.certificate is None: |
421 | 426 | return False |
|
0 commit comments