From f9b8183c16d7c109034420a17c063effb282f22e Mon Sep 17 00:00:00 2001 From: sunguroku <65516095+sunguroku@users.noreply.github.com> Date: Wed, 22 May 2024 14:52:33 -0400 Subject: [PATCH] Delete namespace (#4684) Co-authored-by: sunguroku --- api/server/handlers/project/delete.go | 17 +++++++++++++++++ .../services-settings/tabs/Advanced.tsx | 2 +- .../services-settings/tabs/Advanced.tsx | 2 +- go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/api/server/handlers/project/delete.go b/api/server/handlers/project/delete.go index 7903024238..96e47876eb 100644 --- a/api/server/handlers/project/delete.go +++ b/api/server/handlers/project/delete.go @@ -51,6 +51,23 @@ func (p *ProjectDeleteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) continue } + if cluster.CloudProvider == "Hosted" { + req := connect.NewRequest(&porterv1.DeletePorterCloudClusterRequest{ + ClusterId: int64(cluster.ID), + ProjectId: int64(cluster.ProjectID), + }) + + _, err = p.Config().ClusterControlPlaneClient.DeletePorterCloudCluster(ctx, req) + if err != nil { + err = telemetry.Error(ctx, span, err, "error deleting cluster") + p.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusInternalServerError)) + return + } + + // technically multiple clusters shouldn't exist in a porter cloud project. + continue + } + contractRevision, err := p.Config().Repo.APIContractRevisioner().List(ctx, proj.ID, repository.WithClusterID(cluster.ID)) if err != nil { e := "error finding contract revisions for cluster" diff --git a/dashboard/src/legacy/main/home/app-dashboard/validate-apply/services-settings/tabs/Advanced.tsx b/dashboard/src/legacy/main/home/app-dashboard/validate-apply/services-settings/tabs/Advanced.tsx index f0e5f42107..e32fc489c7 100644 --- a/dashboard/src/legacy/main/home/app-dashboard/validate-apply/services-settings/tabs/Advanced.tsx +++ b/dashboard/src/legacy/main/home/app-dashboard/validate-apply/services-settings/tabs/Advanced.tsx @@ -22,7 +22,7 @@ const Advanced: React.FC = ({ index }) => { Specify how much time service processes are given to gracefully shut down when they receive SIGTERM diff --git a/dashboard/src/main/home/app-dashboard/validate-apply/services-settings/tabs/Advanced.tsx b/dashboard/src/main/home/app-dashboard/validate-apply/services-settings/tabs/Advanced.tsx index f215b969cf..4bfbbc4f5e 100644 --- a/dashboard/src/main/home/app-dashboard/validate-apply/services-settings/tabs/Advanced.tsx +++ b/dashboard/src/main/home/app-dashboard/validate-apply/services-settings/tabs/Advanced.tsx @@ -23,7 +23,7 @@ const Advanced: React.FC = ({ index }) => { Specify how much time service processes are given to gracefully shut down when they receive SIGTERM diff --git a/go.mod b/go.mod index 96b70c1f75..30a2c0a8a0 100644 --- a/go.mod +++ b/go.mod @@ -89,7 +89,7 @@ require ( github.com/nats-io/nats.go v1.24.0 github.com/open-policy-agent/opa v0.44.0 github.com/ory/client-go v1.9.0 - github.com/porter-dev/api-contracts v0.2.164 + github.com/porter-dev/api-contracts v0.2.169 github.com/riandyrn/otelchi v0.5.1 github.com/santhosh-tekuri/jsonschema/v5 v5.0.1 github.com/stefanmcshane/helm v0.0.0-20221213002717-88a4a2c6e77d diff --git a/go.sum b/go.sum index 8557a216ca..61a7eac12f 100644 --- a/go.sum +++ b/go.sum @@ -1570,8 +1570,8 @@ github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= -github.com/porter-dev/api-contracts v0.2.164 h1:99Y96YH9CfAl/aPjnqXbsiEgMHUFxDM9wC5G5sQnmyQ= -github.com/porter-dev/api-contracts v0.2.164/go.mod h1:VV5BzXd02ZdbWIPLVP+PX3GKawJSGQnxorVT2sUZALU= +github.com/porter-dev/api-contracts v0.2.169 h1:bZtfkBkkNRyZtez4zfRxjwTEcIMtwegN9fteGDAw4Q0= +github.com/porter-dev/api-contracts v0.2.169/go.mod h1:VV5BzXd02ZdbWIPLVP+PX3GKawJSGQnxorVT2sUZALU= github.com/porter-dev/switchboard v0.0.3 h1:dBuYkiVLa5Ce7059d6qTe9a1C2XEORFEanhbtV92R+M= github.com/porter-dev/switchboard v0.0.3/go.mod h1:xSPzqSFMQ6OSbp42fhCi4AbGbQbsm6nRvOkrblFeXU4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=