-
Notifications
You must be signed in to change notification settings - Fork 66
Description
🛑 Blocked by:
- [TASK] API that allows frontend to upload a YAML file containing a full new WorkspaceKind definition #278
- [TASK] API that allows frontend to update a WorkspaceKind by uploading a YAML file containing a full WorkspaceKind definition #416
Description
Initially, the frontend
will have the user submit raw YAML WorkspaceKind manifests for the POST
(create) and PUT
(update) endpoints of the /workspacekinds
API suite. As that YAML can be quite large (particularly as the number of options for podConfig
and imageConfig
grows) - we want users to have a sense of confidence prior to them submitting the payload to apply to the cluster.
Inspired by k8s, we want to add support for a ?dry_run=true|false
query parameter to the following endpoints:
POST api/v1/workspacekinds
PUT api/v1/workspacekinds/{name}
The default value for dry_run
(in the event it is not specified) is false
. When dry_run=false
, it is essentially a no-op and the "normal" behavior to create/update the WorkspaceKind
proceeds as usual.
When dry_run=true
, the following constraints apply:
- under no circumstances are changes introduced to k8s as a result of the API call
- a
dry_run
is performed at the kubernetes layer (see: CreateOptions , UpdateOptions )- if no error(s) occur as a result of the
dry_run
:- for
POST
, theapplication/json
data representation of theWorkspaceKind
defined in the YAML is returnedContent-Type: application/json
header returned on response
- for
PUT
, theapplication/json
data representation of theWorkspaceKind
persistend on the cluster is returnedContent-Type: application/json
header returned on response- ℹ while this behavior is at face value misaligned with
POST
behavior, we believe returning the currently persisted object in this case has more future upside to potentially allow UI to emphasize detected changes
- for
- if error(s) occur as a result of the
dry_run
, those errors are returned in the response payload using the standard Error API schema
- if no error(s) occur as a result of the
?dry_run
query parameter should only be honored if Content-Type: application/yaml
provided on the request. In the event dry_run
query parameter is provided, and a valid Content-Type
that is not equal to Content-Type: application/yamlis on the request - a
400` HTTP response code should be returned.
- This likely is irrelevant at this point as
Content-Type: application/yaml
is the only supportedContent-Type
(and a request providing any other header value would/should/could first fail with a415
)
💡 Given the obvious overlap in functionality across POST
and PUT
, the decision was made to raise this issue under a single ticket. We can certainly split this work into issues for each endpoint - but then need to be mindful that they are consistent and leveraging shared code upon. merging.
Acceptance Criteria
- Calling
POST api/v1/workspacekinds?dry_run=false
behaves identically toPOST api/v1/workspacekinds
- i.e. the
WorkspaceKind
is created (if valid) or returns error from attempting to apply to cluster
- i.e. the
- Calling
PUT api/v1/workspacekinds/{name}?dry_run=false
behaves identically toPUT api/v1/workspacekinds
- i.e. the
WorkspaceKind
is updated (if valid) or returns error from attempting to apply to cluster
- i.e. the
- Calling
POST api/v1/workspacekinds?dry_run=true
on a valid manifest payload returns anapplication/json
response following same schema asGET api/v1/workspacekinds/{name}
whenContent-Type: application/json
header present- the
application/json
response is a representation of theWorkspaceKind
as defined in the request payload
- the
- Calling
PUT api/v1/workspacekinds/{name}?dry_run=true
on a valid manifest payload returns anapplication/json
response following same schema asGET api/v1/workspacekinds/{name}
whenContent-Type: application/json
header present- the
application/json
response is a representation of theWorkspaceKind
as its currently persisted on the cluster
- the
- Calling
POST api/v1/workspacekinds?dry_run=true
on an invalid manifest payload returns anapplication/json
response following Error schema used in Notebooks 2.0- all errors returned from attempting to
dry_run
via the controller-runtime client should be encoded in response
- all errors returned from attempting to
- Calling
POST api/v1/workspacekinds?dry_run=true
on an invalid manifest payload returns anapplication/json
response following Error schema used in Notebooks 2.0- all errors returned from attempting to
dry_run
via the controller-runtime client should be encoded in response
- all errors returned from attempting to
- Providing any value to the
dry_run
query parameter argument that is not equal to one of (true
,false
) should return a400
error
Metadata
Metadata
Assignees
Labels
Type
Projects
Status