Skip to content

feat(ws): Implement workspace start + pause as backend APIs #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: notebooks-v2
Choose a base branch
from

Conversation

andyatmiami
Copy link

@andyatmiami andyatmiami commented May 14, 2025

related: #298

  • Added StartWorkspaceHandler + PauseWorkspaceHandler to handle the respective workspace actions
  • Introduced new routes for starting and pausing workspaces in the API.
    • api/v1/workspaces/{namespace}/{name}/actions/start
    • api/v1/workspaces/{namespace}/{name}/actions/pause
  • Created a new PauseStateEnvelope type for successful responses.
  • Leveraging JSONPatch / client.RawPatch to ensure Workspace in "valid state" before attempting action
    • for start: spec.paused must be true, and status.state must be Paused
    • for pause: spec.paused must be false
      • note: I would love to have a status.state check here of status.state != Paused, but that type of comparison is not supported in JSONPatch
  • Added tests for the new APIs, including success and error cases.
  • Updated README/OpenAPI documentation to include the new endpoints.

Functionality tested/verified via generated Swagger client:

HAPPY PATH
image

image

ERROR PATH
image

image

Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kimwnasptd for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ederign
Copy link
Member

ederign commented May 14, 2025

/ok-to-test

@andyatmiami andyatmiami force-pushed the feat/workspace-start-api branch 3 times, most recently from fb2e2fb to f22b3d3 Compare May 15, 2025 20:54
Copy link

@harshad16 harshad16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work 💯
Tested with cli:
Screenshot from 2025-05-20 16-50-35

@andyatmiami andyatmiami force-pushed the feat/workspace-start-api branch 2 times, most recently from 8d5e467 to 3237336 Compare May 21, 2025 18:05
@andyatmiami andyatmiami marked this pull request as ready for review May 21, 2025 18:08
@andyatmiami andyatmiami changed the title feat(ws): Add start workspace functionality to backend API feat(ws): Implement workspace start + pause as backend APIs May 21, 2025
@andyatmiami andyatmiami requested a review from harshad16 May 21, 2025 18:10
Copy link
Member

@ederign ederign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions inline.

related: kubeflow#298

- Added StartWorkspaceHandler + PauseWorkspaceHandler to handle the respective workspace actions
- Introduced new routes for starting and pausing workspaces in the API.
    - `api/v1/workspaces/{namespace}/{name}/actions/start`
    - `api/v1/workspaces/{namespace}/{name}/actions/pause`
- Created a new PauseStateEnvelope type for successful responses.
- Leveraging JSONPatch / client.RawPatch to ensure Workspace in "valid state" before attempting action
    - for `start`: `spec.paused` must be `true`, and `status.state` must be `Paused`
    - for `pause`: `spec.paused` must be `false`
        - note: I would love to have a `status.state` check here of `status.state != Paused`, but that type of comparison is not supported in [JSONPatch](https://datatracker.ietf.org/doc/html/rfc6902#section-4.6)
- Added tests for the new APIs, including success and error cases.
- Updated README/OpenAPI documentation to include the new endpoints.

Signed-off-by: Andy Stoneberg <[email protected]>
@andyatmiami andyatmiami force-pushed the feat/workspace-start-api branch from ba9e1bc to 575e1a8 Compare June 3, 2025 21:46
@andyatmiami andyatmiami requested a review from ederign June 3, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

4 participants