Skip to content

Commit

Permalink
feat: add support for delete propagation policy (#9113)
Browse files Browse the repository at this point in the history
* add support for propagation policy to delete resource, update UI and regenerate API schema

* fix gql schema

* update schema

* update schema

* make fix

* fix prettier
  • Loading branch information
floreks authored Jun 3, 2024
1 parent 881c6da commit 42b1564
Show file tree
Hide file tree
Showing 20 changed files with 503 additions and 331 deletions.
6 changes: 5 additions & 1 deletion modules/api/pkg/handler/apihandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@ func CreateHTTPAPIHandler(iManager integration.Manager) (*restful.Container, err
Param(apiV1Ws.PathParameter("namespace", "namespace of the resource")).
Param(apiV1Ws.PathParameter("name", "name of the resource")).
Param(apiV1Ws.QueryParameter("deleteNow", "override graceful delete options and enforce immediate deletion")).
Param(apiV1Ws.QueryParameter("propagation", "override default delete propagation policy")).
Returns(http.StatusNoContent, "", nil))
apiV1Ws.Route(
apiV1Ws.GET("/_raw/{kind}/namespace/{namespace}/name/{name}").To(apiHandler.handleGetResource).
Expand Down Expand Up @@ -912,6 +913,8 @@ func CreateHTTPAPIHandler(iManager integration.Manager) (*restful.Container, err
Doc("deletes a non-namespaced resource").
Param(apiV1Ws.PathParameter("kind", "kind of the resource")).
Param(apiV1Ws.PathParameter("name", "name of the resource")).
Param(apiV1Ws.QueryParameter("deleteNow", "override graceful delete options and enforce immediate deletion")).
Param(apiV1Ws.QueryParameter("propagation", "override default delete propagation policy")).
Returns(http.StatusNoContent, "", nil))
apiV1Ws.Route(
apiV1Ws.GET("/_raw/{kind}/name/{name}").To(apiHandler.handleGetResource).
Expand Down Expand Up @@ -2355,9 +2358,10 @@ func (apiHandler *APIHandler) handleDeleteResource(
kind := request.PathParameter("kind")
namespace := request.PathParameters()["namespace"]
name := request.PathParameter("name")
propagation := request.QueryParameter("propagation")
deleteNow := request.QueryParameter("deleteNow") == "true"

if err := verber.Delete(kind, namespace, name, deleteNow); err != nil {
if err := verber.Delete(kind, namespace, name, propagation, deleteNow); err != nil {
errors.HandleInternalError(response, err)
return
}
Expand Down
Loading

0 comments on commit 42b1564

Please sign in to comment.