Skip to content
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

fix(ws): update JSON payload for listing workspaces #134

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

Conversation

mohamedch7
Copy link

Fix: Update Workspace Model and JSON Payload Structure

This PR addresses issue #127 by refactoring the workspace model and adjusting the JSON payload structure to align with the updated API requirements.

Changes Made

  • Workspace Model Updates:

    • Introduced new fields: WorkspaceKind, PodTemplate, Activity, and Volumes.
    • Updated nested models (PodMetadata, ImageConfig, PodConfig) for improved modularity.
  • Handler Updates:

    • Refactored test cases in workspaces_handler_test.go to validate the new model and payload structure.
  • Repository Adjustments:

    • Updated the CreateWorkspace method in workspaces.go to reflect the new model structure.
    • Ensured compatibility with nested fields during workspace creation.
  • Payload Adjustments:

    • Ensured responses match the updated API specification.

Impact

  • Aligns backend structure with updated API expectations.

Testing

  • Unit tests in workspaces_handler_test.go updated to include new cases.

Signed-off-by: mohamedch7 <121046693+mohamedch7@users.noreply.github.com>
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 Nov 27, 2024

@mohamedch7 thank you so much for the contribution! I'll look it before end of the week.

@thesuperzapper
Copy link
Member

@mohamedch7 once we merge #137 (hopefully tomorrow) please rebase this PR so you get the new linting (and make sure your PR passes a make lint).

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.

Namespace: item.Namespace,
WorkspaceKind: WorkspaceKind{
Name: item.Spec.Kind,
Type: item.Spec.PodTemplate.Options.ImageConfig,
Copy link
Member

Choose a reason for hiding this comment

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

StateMessage: item.Status.StateMessage,
PodTemplate: PodTemplate{
PodMetadata: &PodMetadata{
Labels: item.Spec.PodTemplate.PodMetadata.Labels,
Copy link
Member

Choose a reason for hiding this comment

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

We should avoid nulls on those fields.

PodTemplate: PodTemplate{
PodMetadata: &PodMetadata{
Labels: item.Spec.PodTemplate.PodMetadata.Labels,
Annotations: item.Spec.PodTemplate.PodMetadata.Annotations,
Copy link
Member

Choose a reason for hiding this comment

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

"labels": null,
"annotations": null

},
Volumes: &Volumes{
Home: &DataVolumeModel{
PvcName: item.Spec.PodTemplate.Volumes.Data[0].PVCName,
Copy link
Member

Choose a reason for hiding this comment

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

Home is not Volumes.Data[0], but instead defined by kind:
the mount path is defined in the WorkspaceKind under
## spec.podTemplate.volumeMounts.home

MountPath: item.Spec.PodTemplate.Volumes.Data[0].MountPath,
ReadOnly: *item.Spec.PodTemplate.Volumes.Data[0].ReadOnly,
},
Data: dataVolumes,
Copy link
Member

Choose a reason for hiding this comment

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

Make sure to don't list 'home' here.

},
PodConfig: &PodConfig{
Current: item.Spec.PodTemplate.Options.PodConfig,
Desired: item.Spec.PodTemplate.Options.PodConfig,
Copy link
Member

Choose a reason for hiding this comment

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

It should be:
Pod Template Options:
Image Config:
Desired: jupyterlab_scipy_190

Copy link
Member

Choose a reason for hiding this comment

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

(on status)

@ederign
Copy link
Member

ederign commented Dec 2, 2024

Also, make sure to rebase it to include the new linting etc.

@thesuperzapper
Copy link
Member

@mohamedch7 you should be able to rebase it to head of notebooks-v2 now, and then make sure make lint and make test pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

3 participants