Skip to content

Commit

Permalink
fix: delete cluster and ns if it is first cluster
Browse files Browse the repository at this point in the history
Signed-off-by: FogDong <fog@bentoml.com>
  • Loading branch information
FogDong committed Jul 18, 2024
1 parent 65b22ef commit 33d724f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/bentoml/_internal/cloud/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,12 @@ def _generate_deployment_info_(
context: str | None, res: DeploymentSchema, urls: list[str] | None = None
) -> DeploymentInfo:
client = get_rest_api_client(context)
admin_console = f"{client.v1.endpoint}/deployments/{res.name}"
if res.cluster.is_first is False:
admin_console = f"{client.v1.endpoint}/deployments/{res.name}?cluster={res.cluster.name}&namespace={res.kube_namespace}"
return DeploymentInfo(
name=res.name,
admin_console=f"{client.v1.endpoint}/deployments/{res.name}?cluster={res.cluster.name}&namespace={res.kube_namespace}",
admin_console=admin_console,
created_at=res.created_at.strftime("%Y-%m-%d %H:%M:%S"),
created_by=res.creator.name,
cluster=res.cluster.name,
Expand Down
1 change: 1 addition & 0 deletions src/bentoml/_internal/cloud/schemas/schemasv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class ClusterSchema(ResourceSchema):
description: str
organization_name: str
creator: UserSchema
is_first: t.Optional[bool]


@attr.define
Expand Down

0 comments on commit 33d724f

Please sign in to comment.