diff --git a/src/dstack/_internal/cli/services/configurators/gateway.py b/src/dstack/_internal/cli/services/configurators/gateway.py index dae75668c..45fb06cba 100644 --- a/src/dstack/_internal/cli/services/configurators/gateway.py +++ b/src/dstack/_internal/cli/services/configurators/gateway.py @@ -22,6 +22,7 @@ GatewayStatus, ) from dstack._internal.core.models.repos.base import Repo +from dstack._internal.core.services.diff import diff_models from dstack._internal.utils.common import local_time from dstack.api._public import Client @@ -56,7 +57,15 @@ def apply_configuration( confirm_message += "Create the gateway?" else: action_message += f"Found gateway [code]{plan.spec.configuration.name}[/]." - if plan.current_resource.configuration == plan.spec.configuration: + diff = diff_models( + plan.spec.configuration, + plan.current_resource.configuration, + ) + changed_fields = list(diff.keys()) + if ( + plan.current_resource.configuration == plan.spec.configuration + or changed_fields == ["default"] + ): if command_args.yes and not command_args.force: # --force is required only with --yes, # otherwise we may ask for force apply interactively. diff --git a/src/dstack/_internal/server/services/fleets.py b/src/dstack/_internal/server/services/fleets.py index da93ce50e..07e3ef788 100644 --- a/src/dstack/_internal/server/services/fleets.py +++ b/src/dstack/_internal/server/services/fleets.py @@ -239,7 +239,6 @@ async def get_plan( user: UserModel, spec: FleetSpec, ) -> FleetPlan: - # TODO: refactor offers logic into a separate module to avoid depending on runs current_fleet: Optional[Fleet] = None current_fleet_id: Optional[uuid.UUID] = None if spec.configuration.name is not None: @@ -259,6 +258,7 @@ async def get_plan( requirements=_get_fleet_requirements(spec), ) offers = [offer for _, offer in offers_with_backends] + _remove_fleet_spec_sensitive_info(spec) plan = FleetPlan( project_name=project.name, user=user.name,