Skip to content

Conversation

@ederign
Copy link
Member

@ederign ederign commented Feb 16, 2025

To make FE/Typescript marshaling straightforward, we default our JSON format to camelCase.

Some tests:

// http://localhost:4000/api/v1/healthcheck

{
  "status": "Healthy",
  "systemInfo": {
    "version": "1.0.0"
  }
}
// http://localhost:4000/api/v1/workspacekinds/jupyterlab
{
  "data": {
    "name": "jupyterlab",
    "displayName": "JupyterLab Notebook",
    "description": "A Workspace which runs JupyterLab in a Pod",
    "deprecated": false,
    "deprecationMessage": "This WorkspaceKind will be removed on 20XX-XX-XX, please use another WorkspaceKind.",
    "hidden": false,
    "icon": {
      "url": "/workspaces/backend/api/v1/workspacekinds/jupyterlab/assets/icon"
    },
    "logo": {
      "url": "/workspaces/backend/api/v1/workspacekinds/jupyterlab/assets/logo"
    },
    "podTemplate": {
      "podMetadata": {
        "labels": {
          "my-workspace-kind-label": "my-value"
        },
        "annotations": {
          "my-workspace-kind-annotation": "my-value"
        }
      },
      "volumeMounts": {
        "home": "/home/jovyan"
      },
      "options": {
        "imageConfig": {
          "default": "jupyterlab_scipy_190",
          "values": [
            {
              "id": "jupyterlab_scipy_180",
              "displayName": "jupyter-scipy:v1.8.0",
              "description": "JupyterLab, with SciPy Packages",
              "labels": [
                {
                  "key": "python_version",
                  "value": "3.11"
                }
              ],
              "hidden": true,
              "redirect": {
                "to": "jupyterlab_scipy_190",
                "message": {
                  "text": "This update will change...",
                  "level": "Info"
                }
              }
            },
            {
              "id": "jupyterlab_scipy_190",
              "displayName": "jupyter-scipy:v1.9.0",
              "description": "JupyterLab, with SciPy Packages",
              "labels": [
                {
                  "key": "python_version",
                  "value": "3.11"
                }
              ],
              "hidden": false
            }
          ]
        },
        "podConfig": {
          "default": "tiny_cpu",
          "values": [
            {
              "id": "tiny_cpu",
              "displayName": "Tiny CPU",
              "description": "Pod with 0.1 CPU, 128 Mb RAM",
              "labels": [
                {
                  "key": "cpu",
                  "value": "100m"
                },
                {
                  "key": "memory",
                  "value": "128Mi"
                }
              ],
              "hidden": false
            },
            {
              "id": "small_cpu",
              "displayName": "Small CPU",
              "description": "Pod with 1 CPU, 2 GB RAM",
              "labels": [
                {
                  "key": "cpu",
                  "value": "1000m"
                },
                {
                  "key": "memory",
                  "value": "2Gi"
                }
              ],
              "hidden": false
            },
            {
              "id": "big_gpu",
              "displayName": "Big GPU",
              "description": "Pod with 4 CPU, 16 GB RAM, and 1 GPU",
              "labels": [
                {
                  "key": "cpu",
                  "value": "4000m"
                },
                {
                  "key": "memory",
                  "value": "16Gi"
                },
                {
                  "key": "gpu",
                  "value": "1"
                }
              ],
              "hidden": false
            }
          ]
        }
      }
    }
  }
}
// http://localhost:4000/api/v1/workspaces/workspace-test/jupyterlab-workspace

{
  "data": {
    "name": "jupyterlab-workspace",
    "namespace": "workspace-test",
    "workspaceKind": {
      "name": "jupyterlab",
      "missing": false,
      "icon": {
        "url": "/workspaces/backend/api/v1/workspacekinds/jupyterlab/assets/icon"
      },
      "logo": {
        "url": "/workspaces/backend/api/v1/workspacekinds/jupyterlab/assets/logo"
      }
    },
    "deferUpdates": false,
    "paused": false,
    "pausedTime": 0,
    "state": "Running",
    "stateMessage": "Workspace is running",
    "podTemplate": {
      "podMetadata": {
        "labels": {
          
        },
        "annotations": {
          
        }
      },
      "volumes": {
        "home": {
          "pvcName": "workspace-home-pvc",
          "mountPath": "/home/jovyan",
          "readOnly": false
        },
        "data": [
          {
            "pvcName": "workspace-data-pvc",
            "mountPath": "/data/my-data",
            "readOnly": false
          }
        ]
      },
      "options": {
        "imageConfig": {
          "current": {
            "id": "jupyterlab_scipy_190",
            "displayName": "jupyter-scipy:v1.9.0",
            "description": "JupyterLab, with SciPy Packages",
            "labels": [
              {
                "key": "python_version",
                "value": "3.11"
              }
            ]
          }
        },
        "podConfig": {
          "current": {
            "id": "tiny_cpu",
            "displayName": "Tiny CPU",
            "description": "Pod with 0.1 CPU, 128 Mb RAM",
            "labels": [
              {
                "key": "cpu",
                "value": "100m"
              },
              {
                "key": "memory",
                "value": "128Mi"
              }
            ]
          }
        }
      }
    },
    "activity": {
      "lastActivity": 0,
      "lastUpdate": 0
    }
  }
}
 curl -i -X POST http://localhost:4000/api/v1/workspaces/default \                   (kind-notebooks-v2/default)
    -H "Content-Type: application/json" \
    -d '{
    "data": {
        "name": "asdfdora",
        "kind": "jupyterlab",
        "paused": false,
        "deferUpdates": false,
        "podTemplate": {
            "podMetadata": {
                "labels": {
                    "app": "dora"
                },
                "annotations": {
                    "app": "dora"
                }
            },
            "volumes": {
                "home": "workspace-home-bella",
                "data": [
                    {
                        "pvcName": "workspace-data-bella",
                        "mountPath": "/data/my-data",
                        "readOnly": false
                    }
                ]
            },
            "options": {
                "imageConfig": "jupyterlab_scipy_190",
                "podConfig": "tiny_cpu"
            }
        }
    }
}'
HTTP/1.1 201 Created
Access-Control-Allow-Origin: *
Content-Type: application/json
Location: /api/v1/workspaces/default/asdfdora
Date: Sun, 16 Feb 2025 15:33:36 GMT
Content-Length: 505

{
	"data": {
		"name": "asdfdora",
		"kind": "jupyterlab",
		"paused": false,
		"deferUpdates": false,
		"podTemplate": {
			"podMetadata": {
				"labels": {
					"app": "dora"
				},
				"annotations": {
					"app": "dora"
				}
			},
			"volumes": {
				"home": "workspace-home-bella",
				"data": [
					{
						"pvcName": "workspace-data-bella",
						"mountPath": "/data/my-data"
					}
				]
			},
			"options": {
				"imageConfig": "jupyterlab_scipy_190",
				"podConfig": "tiny_cpu"
			}
		}
	}
}

Signed-off-by: Eder Ignatowicz <ignatowicz@gmail.com>
@ederign
Copy link
Member Author

ederign commented Feb 16, 2025

@paulovmr, could you please review this one to see if it fits your needs?

@ederign
Copy link
Member Author

ederign commented Feb 16, 2025

/assign @paulovmr

Copy link

@paulovmr paulovmr left a comment

Choose a reason for hiding this comment

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

Thanks, @ederign !

@paulovmr
Copy link

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Feb 17, 2025
@ederign
Copy link
Member Author

ederign commented Feb 23, 2025

@thesuperzapper, when you have a chance, would you mind reviewing this? Or, as @paulovmr tested and approved (from FE perspective), you can lgtm to unblock FE development, and I can accommodate your eventual requests later in a FUP PR.

@thesuperzapper
Copy link
Member

@ederign sorry for the delay, this looks good for now, if someone finds an instance of _ somewhere we can do a follow up.

I mean you could also just do a quick project wide search for all instances of _ and see if anything is out of place.

Approving for now to unblock.

/ok-to-test
/approve

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: paulovmr, thesuperzapper

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

The pull request process is described 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

@google-oss-prow google-oss-prow bot merged commit 365c44b into kubeflow:notebooks-v2 Feb 24, 2025
11 of 12 checks passed
Al-Pragliola pushed a commit to Al-Pragliola/notebooks that referenced this pull request Apr 2, 2025
…ubeflow#214)

Signed-off-by: Eder Ignatowicz <ignatowicz@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
caponetto pushed a commit to caponetto/kubeflow-notebooks that referenced this pull request Apr 30, 2025
mkoushni pushed a commit to mkoushni/notebooks that referenced this pull request May 28, 2025
…ubeflow#214)

Signed-off-by: Eder Ignatowicz <ignatowicz@gmail.com>
Signed-off-by: CI Bot <mkoushni@redhat.com>
mkoushni pushed a commit to mkoushni/notebooks that referenced this pull request Jun 4, 2025
…ubeflow#214)

Signed-off-by: Eder Ignatowicz <ignatowicz@gmail.com>
Signed-off-by: CI Bot <mkoushni@redhat.com>
andyatmiami pushed a commit to andyatmiami/kubeflow-notebooks that referenced this pull request Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants