feat(ws): Implement DELETE endpoint for WorkspaceKind #480
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DELETE /workspacekinds/{name}
The implementation is more or less a "carbon copy" of how it is implemented for Workspaces with the exception of the need to handle the
Conflict
that can be returned by the admission webhook. While there is basic handling of this condition in the PR - I'm not necessarily happy with it.First off, there is an error message prefix inserted by kubernetes itself:
The
admission webhook \"vworkspacekind.kb.io\" denied the request:
is appended on the error message returned fromworkspacekind_webhook.go
and not easily able to be omitted (without falling back to brittle string parsing). I personally don't think that is appropriate details to put in an error message that could be surfaced in the UI. And while aConflict
error today is the only surfaced from the workspacekind webhook code if a workspace is using it - I'm not confident that condition would hold in the future... and there is no other information I can reliably act on to distinguish this particular cause (to simply provide a more succinct error message inrepo.go
)Furthermore, our testing framework does not currently run with webhooks - so I have deliberately NOT added a test case for this behavior.