Skip to content

Commit

Permalink
PLT-190: apply cluster context on delete. (#193)
Browse files Browse the repository at this point in the history
Co-authored-by: nikolay-spectro <[email protected]>
  • Loading branch information
nikchern and nikchern authored Dec 27, 2022
1 parent c169d2c commit 1fab5ed
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pkg/client/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,23 @@ func (h *V1Client) DeleteCluster(uid string) error {
return nil
}

params := clusterC.NewV1SpectroClustersDeleteParamsWithContext(h.Ctx).WithUID(uid)
cluster, err := h.GetCluster(uid)
if err != nil || cluster == nil {
return err
}

var params *clusterC.V1SpectroClustersDeleteParams
switch cluster.Metadata.Annotations["scope"] {
case "project":
params = clusterC.NewV1SpectroClustersDeleteParamsWithContext(h.Ctx).WithUID(uid)
break
case "tenant":
params = clusterC.NewV1SpectroClustersDeleteParams().WithUID(uid)
break
default:
break
}

_, err = client.V1SpectroClustersDelete(params)
return err
}
Expand Down

0 comments on commit 1fab5ed

Please sign in to comment.