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

Feat/image builder api #614

Open
wants to merge 26 commits into
base: kpack-resources
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e802870
add k8s cache client for shipwright buildruns
Panaetius Dec 10, 2024
22749bc
fix(linting): import order
SalimKayal Jan 21, 2025
2ffa0ae
feat(api): introduce endpoints for image builders
SalimKayal Jan 21, 2025
8d01b4c
feat(models): add model for image builders
SalimKayal Jan 21, 2025
8708ee5
fix(consistency): lowercase for StrEnums
SalimKayal Jan 22, 2025
dada2a8
fix(semantics): change EditorKind to FrontendKind
SalimKayal Jan 22, 2025
15d1041
fix(apispec): assume container_image is deterministic for image builders
SalimKayal Jan 22, 2025
35705e4
fix(apispec): branch to revision in image builders
SalimKayal Jan 22, 2025
651beed
fix(apispec): change required fields for image builders
SalimKayal Jan 22, 2025
3e945bf
Address (some) review comments
mohammad-alisafaee Jan 24, 2025
9cd24a9
fix after rebase
mohammad-alisafaee Jan 29, 2025
c96cfae
update
mohammad-alisafaee Jan 30, 2025
739f3a9
Change back EnvironmentKind enum to uppercase
mohammad-alisafaee Jan 30, 2025
35e86de
Address comments
mohammad-alisafaee Jan 30, 2025
127e5f0
Remove build_parameters endpoints
mohammad-alisafaee Jan 30, 2025
ce620e0
Update API
mohammad-alisafaee Jan 31, 2025
3f3adc9
Remove Revision and SubDir for now
mohammad-alisafaee Jan 31, 2025
c3f092e
Address review comments
mohammad-alisafaee Jan 31, 2025
24e8145
Address comments
mohammad-alisafaee Feb 3, 2025
05a69b1
Address comments
mohammad-alisafaee Feb 3, 2025
b5cbfc2
Address comments
mohammad-alisafaee Feb 3, 2025
622accd
Update API
mohammad-alisafaee Feb 7, 2025
a4c4c06
Update API
mohammad-alisafaee Feb 12, 2025
afc5b6f
Implement API
mohammad-alisafaee Feb 12, 2025
b5971db
Undo EnvironmentKind enum case change
mohammad-alisafaee Feb 12, 2025
c8fc993
Fix tests
mohammad-alisafaee Feb 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ async def get_server(self, name: str, safe_username: str) -> _SessionType | None
If the request to the cache fails, fallback to the k8s API.
"""
server = None
try:
server = await self.cache.get_server(name)
except CacheError:
Expand Down
155 changes: 127 additions & 28 deletions components/renku_data_services/session/api.spec.yaml
leafty marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ components:
type: array
items:
$ref: "#/components/schemas/Environment"
Environment:
EnvironmentWithoutContainerImage:
description: A Renku 2.0 session environment
type: object
properties:
Expand All @@ -272,8 +272,6 @@ components:
$ref: "#/components/schemas/CreationDate"
description:
$ref: "#/components/schemas/Description"
container_image:
$ref: "#/components/schemas/ContainerImage"
default_url:
$ref: "#/components/schemas/DefaultUrl"
uid:
Expand All @@ -296,46 +294,64 @@ components:
- id
- name
- creation_date
- container_image
- port
- uid
- gid
- default_url
example:
id: 01AN4Z79ZS6XX96588FDX0H099
name: JupyterLab environment
creation_date: "2023-11-01T17:32:28Z"
description: JupyterLab session environment
container_image: renku-jupyter:latest
default_url: "/lab"
port: 8080
working_directory: /home/jovyan/work
mount_directory: /home/jovyan/work
uid: 1000
gid: 1000
is_archive: false
Environment:
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: We can replace this with EnvironmentWithImageGet and not break the API. EnvironmentWithImageGet just has two extra mandatory fields over Environment. That is environment_image_source and environment_kind. And the addition of those two would be useful too.

allOf:
- $ref: "#/components/schemas/EnvironmentWithoutContainerImage"
- type: object
properties:
container_image:
$ref: "#/components/schemas/ContainerImage"
required:
- container_image
EnvironmentGetInLauncher:
allOf:
- $ref: "#/components/schemas/Environment"
- oneOf:
- $ref: "#/components/schemas/EnvironmentWithImageGet"
- $ref: "#/components/schemas/EnvironmentWithBuildGet"
- type: object
properties:
environment_kind:
$ref: "#/components/schemas/EnvironmentKind"
required:
- environment_kind
example:
environment_kind: global_environment
EnvironmentWithImageGet:
allOf:
- $ref: "#/components/schemas/Environment"
- type: object
properties:
environment_image_source:
$ref: "#/components/schemas/EnvironmentImageSourceImage"
required:
- environment_image_source
EnvironmentWithBuildGet:
allOf:
- $ref: "#/components/schemas/EnvironmentWithoutContainerImage"
- type: object
properties:
container_image:
$ref: "#/components/schemas/ContainerImage"
build_parameters:
$ref: "#/components/schemas/BuildParameters"
environment_image_source:
$ref: "#/components/schemas/EnvironmentImageSourceBuild"
required:
- build_parameters
- environment_image_source
EnvironmentPostInLauncher:
allOf:
- $ref: "#/components/schemas/EnvironmentPost"
- oneOf:
- $ref: "#/components/schemas/EnvironmentPost"
- $ref: "#/components/schemas/BuildParametersPost"
- type: object
properties:
environment_kind:
$ref: "#/components/schemas/EnvironmentKind"
required:
- environment_kind
example:
environment_kind: global_environment
EnvironmentPost:
description: Data required to create a session environment
type: object
Expand Down Expand Up @@ -377,16 +393,21 @@ components:
is_archived:
$ref: "#/components/schemas/IsArchived"
default: false
environment_image_source:
$ref: "#/components/schemas/EnvironmentImageSourceImage"
olevski marked this conversation as resolved.
Show resolved Hide resolved
required:
- name
- container_image
- environment_image_source
EnvironmentPatchInLauncher:
allOf:
- $ref: "#/components/schemas/EnvironmentPatch"
- type: object
properties:
environment_kind:
$ref: "#/components/schemas/EnvironmentKind"
required:
- environment_kind
EnvironmentPatch:
type: object
description: Update a session environment
Expand Down Expand Up @@ -416,6 +437,10 @@ components:
$ref: "#/components/schemas/EnvironmentArgs"
is_archived:
$ref: "#/components/schemas/IsArchived"
environment_image_source:
$ref: "#/components/schemas/EnvironmentImageSource"
build_parameters:
$ref: "#/components/schemas/BuildParametersPatch"
SessionLaunchersList:
description: A list of Renku session launchers
type: array
Expand Down Expand Up @@ -506,6 +531,19 @@ components:
minLength: 1
maxLength: 99
example: My Renku Session :)
BuilderVariant:
description: Type of virtual environment manager when building custom environments.
type: string
enum:
- conda
- pip
FrontendVariant:
description: User's Frontend Choice.
type: string
enum:
- vscodium
- jupyterlab
- streamlit
EnvironmentIdOnlyPatch:
type: object
properties:
Expand All @@ -519,12 +557,24 @@ components:
required:
- id
EnvironmentKind:
description: Kind of environment to use
description: Kind of the environment
type: string
enum:
- GLOBAL
- CUSTOM
example: CUSTOM
- global
- custom
EnvironmentImageSourceImage:
type: string
enum:
- image
EnvironmentImageSourceBuild:
type: string
enum:
- build
EnvironmentImageSource:
description: Source of the environment's image
oneOf:
- $ref: "#/components/schemas/EnvironmentImageSourceImage"
- $ref: "#/components/schemas/EnvironmentImageSourceBuild"
EnvironmentId:
description: Id of the environment to use
type: string
Expand All @@ -539,6 +589,48 @@ components:
description: A description for the resource
type: string
maxLength: 500
BuildParameters:
description: Build parameters
type: object
additionalProperties: false
properties:
repository:
$ref: "#/components/schemas/Repository"
builder_variant:
$ref: "#/components/schemas/BuilderVariant"
frontend_variant:
$ref: "#/components/schemas/FrontendVariant"
required:
- repository
- builder_variant
- frontend_variant
BuildParametersPost:
mohammad-alisafaee marked this conversation as resolved.
Show resolved Hide resolved
description: Data required to create a build
type: object
properties:
repository:
$ref: "#/components/schemas/Repository"
builder_variant:
$ref: "#/components/schemas/BuilderVariant"
frontend_variant:
$ref: "#/components/schemas/FrontendVariant"
environment_image_source:
$ref: "#/components/schemas/EnvironmentImageSourceBuild"
required:
- repository
- builder_variant
- frontend_variant
- environment_image_source
BuildParametersPatch:
description: Data for updating a build
type: object
properties:
repository:
$ref: "#/components/schemas/Repository"
builder_variant:
$ref: "#/components/schemas/BuilderVariant"
frontend_variant:
$ref: "#/components/schemas/FrontendVariant"
ContainerImage:
description: A container image
type: string
Expand All @@ -547,6 +639,11 @@ components:
# based on https://github.com/opencontainers/distribution-spec/blob/main/spec.md
pattern: "^[a-z0-9]+((\\.|_|__|-+)[a-z0-9]+)*(\\/[a-z0-9]+((\\.|_|__|-+)[a-z0-9]+)*)*(:[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}|@sha256:[a-fA-F0-9]{64}){0,1}$"
example: renku/renkulab-py:3.10-0.18.1
Repository:
description: The repository used as a basis for a custom builder
type: string
maxLength: 500
example: "https://github.com/voila-gallery/gaussian-density"
DefaultUrl:
description: The default path to open in a session
type: string
Expand Down Expand Up @@ -596,7 +693,9 @@ components:
example: "/home/jovyan/work"
EnvironmentMountDirectory:
type: string
description: The location where the persistent storage for the session will be mounted, usually it should be identical to or a parent of the working directory, if left unset will default to the working directory.
description:
The location where the persistent storage for the session will be mounted, usually it should be identical to or
a parent of the working directory, if left unset will default to the working directory.
minLength: 1
example: "/home/jovyan/work"
EnvironmentMountDirectoryPatch:
Expand Down
Loading
Loading