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

Merge data connectors and notebooks/amalthea migration #428

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
823096a
refactor: migrate to entity slugs (#384)
leafty Sep 13, 2024
725dde3
feat!: namespaced data connectors (#386)
leafty Sep 16, 2024
8fa801c
feat: add authz for data connectors
leafty Sep 17, 2024
e06d710
feat: link data connectors to projects
leafty Sep 17, 2024
d67374c
update api
leafty Sep 17, 2024
b8ba215
add migration
leafty Sep 17, 2024
8dd237a
wip links
leafty Sep 17, 2024
b1d904a
wip links
leafty Sep 17, 2024
e495abb
wip links
leafty Sep 17, 2024
dbf0a66
add link
leafty Sep 18, 2024
b8dfc15
more wip on links
leafty Sep 18, 2024
abd3535
wip: delete links
leafty Sep 18, 2024
3a328ea
rename
leafty Sep 18, 2024
2aab4c9
adjust add_link permission
leafty Sep 19, 2024
26171ef
update schema for secrets
leafty Sep 19, 2024
fcc55a4
wip: secrets scaffolding
leafty Sep 19, 2024
f44dbbe
wip secrets
leafty Sep 19, 2024
8179dcd
fix delete
leafty Sep 19, 2024
30ec323
fix delete storage config fields
leafty Sep 19, 2024
6dcb37a
fix: delete storage config fields (#416)
leafty Sep 19, 2024
9159faa
Merge remote-tracking branch 'origin/leafty/build-data-connectors' in…
leafty Sep 20, 2024
17865a2
add tests
leafty Sep 20, 2024
f61433c
Merge remote-tracking branch 'origin/leafty/feat-namespaced-data-conn…
leafty Sep 20, 2024
234d5b0
add tests for linking
leafty Sep 20, 2024
5e71267
add more tests
leafty Sep 20, 2024
bdbd9ee
remove comment
leafty Sep 20, 2024
881db23
Merge remote-tracking branch 'origin/leafty/feat-namespaced-data-conn…
leafty Sep 20, 2024
1b7493d
use PUT for secrets
leafty Sep 20, 2024
a422901
add more tests
leafty Sep 20, 2024
b06d61f
Merge remote-tracking branch 'origin/leafty/feat-namespaced-data-conn…
leafty Sep 20, 2024
793566a
wip secrets
leafty Sep 20, 2024
e403d4c
wip secrets
leafty Sep 20, 2024
d3104f8
Update components/renku_data_services/authz/authz.py
leafty Sep 20, 2024
5f476b0
update schema
leafty Sep 20, 2024
6bf1bcf
refactor: migrate to entity slugs (#384)
leafty Sep 13, 2024
798871f
feat!: namespaced data connectors (#386)
leafty Sep 16, 2024
739e439
fix: delete storage config fields (#416)
leafty Sep 19, 2024
b4446b2
Merge remote-tracking branch 'origin/leafty/build-data-connectors' in…
leafty Sep 23, 2024
d1023c2
Merge branch 'leafty/feat-namespaced-data-connectors-3' into leafty/f…
leafty Sep 23, 2024
cf6d27d
Merge branch 'leafty/feat-namespaced-data-connectors-4' into leafty/f…
leafty Sep 23, 2024
b46b430
wip test
leafty Sep 23, 2024
1f9852a
wip delete
leafty Sep 23, 2024
c70e176
set null to remove
leafty Sep 23, 2024
0153859
feat: add new apispec for the new amalthea sessions (#360)
olevski Sep 20, 2024
99e2296
feat!: expand environments specification (#338)
olevski Sep 20, 2024
8878712
feat: run notebooks in data service (#375)
olevski Sep 23, 2024
91edab1
squashme: changes from PR conflicts resolution
olevski Sep 23, 2024
a4d2e26
feat: add cloud storage via rclone
olevski Sep 4, 2024
fa13825
squashme: address comments
olevski Sep 23, 2024
8dcff56
use patch
leafty Sep 24, 2024
e6d53d2
fix validate_body_root_model
leafty Sep 24, 2024
3c45ace
fix apispec issue
leafty Sep 24, 2024
0f060bf
feat: add new apispec for the new amalthea sessions (#360)
olevski Sep 20, 2024
934c4d2
feat!: expand environments specification (#338)
olevski Sep 20, 2024
1f3264c
feat: run notebooks in data service (#375)
olevski Sep 23, 2024
a45bec2
feat: ensure notebook endpoints do their job (#388)
sgaist Sep 25, 2024
f02def2
Merge data connectors and notebooks/amalthea migration
leafty Sep 26, 2024
7f1e424
fix big type issues
leafty Sep 26, 2024
6d92c14
chore: fix polylith error in tests (#426)
olevski Sep 25, 2024
c6b79d0
remove unused code
leafty Sep 27, 2024
188841f
load data connectors
leafty Sep 27, 2024
689585b
feat: use cloud storage from amalthea (#387)
olevski Sep 27, 2024
b2f6910
Merge remote-tracking branch 'origin/release-amaltheas-migration' int…
leafty Sep 30, 2024
7fcfa17
feat: perf improvements for amalthea sessions (#411)
olevski Oct 1, 2024
2f83815
Merge remote-tracking branch 'origin/release-amaltheas-migration' int…
leafty Oct 2, 2024
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
1 change: 0 additions & 1 deletion .devcontainer/.poetry_cache/.keep
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

12 changes: 8 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@
"command": "poetry self add poetry-polylith-plugin"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/mpriscella/features/kind:1": {},
"ghcr.io/devcontainers-contrib/features/gh-release:1": {
"repo": "authzed/zed",
"binaryNames": "zed"
"binaryNames": "zed",
"version": "v0.21.1"
},
"ghcr.io/devcontainers-contrib/features/spicedb:1": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"minikube": "none"
},
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {},
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {
"jqVersion": "latest",
"yqVersion": "latest"
},
"ghcr.io/dhoeric/features/k9s:1": {},
"ghcr.io/EliiseS/devcontainer-features/bash-profile:1": {
"command": "alias k=kubectl"
},
"ghcr.io/devcontainers-contrib/features/rclone:1": {}
"ghcr.io/devcontainers-contrib/features/rclone:1": {},
"./k3d": {}
},
"overrideFeatureInstallOrder": [
"ghcr.io/devcontainers-contrib/features/poetry",
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ services:
ZED_TOKEN: renku
ZED_INSECURE: "true"
POETRY_CACHE_DIR: "/poetry_cache"
NB_SERVER_OPTIONS__DEFAULTS_PATH: /workspace/server_defaults.json
NB_SERVER_OPTIONS__UI_CHOICES_PATH: /workspace/server_options.json
network_mode: service:db
depends_on:
- db
Expand All @@ -43,6 +45,7 @@ services:
- "8080:8080"
- "5678:5678"
- "50051:50051"
- "8888:80"

swagger:
image: swaggerapi/swagger-ui
Expand Down
17 changes: 17 additions & 0 deletions .devcontainer/k3d/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"id": "k3d",
"version": "1.0.0",
"name": "k3s based kubernetes cluster in docker",
"postCreateCommand": "k3d --version",
"installsAfter": [
"ghcr.io/devcontainers-contrib/features/bash-command"
],
"options": {
"k3d_version": {
"type": "string",
"description": "k3d version to install",
"proposals": ["latest", "5.7.4"],
"default": "latest"
}
}
}
14 changes: 14 additions & 0 deletions .devcontainer/k3d/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
if [ "${K3D_VERSION}" != "none" ]; then
echo "Downloading k3d..."
if [ "${K3D_VERSION}" = "latest" ]; then
# Install and check the hash
curl -sSL https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
else
find_version_from_git_tags K3D_VERSION https://github.com/kubernetes/K3D
if [ "${K3D_VERSION::1}" != "v" ]; then
K3D_VERSION="v${K3D_VERSION}"
fi
# Install and check the hash
curl -sSL https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG="${K3D_VERSION}" bash
fi
fi
4 changes: 4 additions & 0 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
renku-graph: ${{ steps.deploy-comment.outputs.renku-graph}}
renku-notebooks: ${{ steps.deploy-comment.outputs.renku-notebooks}}
renku-ui: ${{ steps.deploy-comment.outputs.renku-ui}}
amalthea-sessions: ${{ steps.deploy-comment.outputs.amalthea-sessions}}
amalthea: ${{ steps.deploy-comment.outputs.amalthea}}
test-enabled: ${{ steps.deploy-comment.outputs.test-enabled}}
test-cypress-enabled: ${{ steps.deploy-comment.outputs.test-cypress-enabled}}
persist: ${{ steps.deploy-comment.outputs.persist}}
Expand Down Expand Up @@ -84,6 +86,8 @@ jobs:
renku_graph: "${{ needs.check-deploy.outputs.renku-graph }}"
renku_notebooks: "${{ needs.check-deploy.outputs.renku-notebooks }}"
renku_data_services: "@${{ github.head_ref }}"
amalthea: "${{ needs.check-deploy.outputs.amalthea }}"
amalthea_sessions: "${{ needs.check-deploy.outputs.amalthea-sessions }}"
extra_values: "${{ needs.check-deploy.outputs.extra-values }}"

selenium-acceptance-tests:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/save_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Create cache from commits on main

on:
push:
branches:
- main
- chore-add-kind
workflow_dispatch:


jobs:
save-poetry-cache:
runs-on: ubuntu-latest
env:
CACHE_KEY: main-branch-poetry-cache-ubuntu
CACHE_PATH: .devcontainer/.poetry_cache
DEVCONTAINER_IMAGE_CACHE: ghcr.io/swissdatasciencecenter/renku-data-services/devcontainer

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install python deps
uses: devcontainers/[email protected]
with:
runCmd: poetry install --with dev
push: always
skipContainerUserIdUpdate: false
imageName: ${{ env.DEVCONTAINER_IMAGE_CACHE }}
cacheFrom: ${{ env.DEVCONTAINER_IMAGE_CACHE }}
- uses: actions/cache/save@v3
name: Create cache
with:
path: ${{ env.CACHE_PATH }}
key: ${{ env.CACHE_KEY }}
20 changes: 20 additions & 0 deletions .github/workflows/test_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache/restore@v3
name: Restore cache
with:
path: ${{ env.CACHE_PATH }}
key: ${{ env.CACHE_KEY }}
- name: Set Git config
shell: bash
run: |
Expand All @@ -90,6 +95,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache/restore@v3
name: Restore cache
with:
path: ${{ env.CACHE_PATH }}
key: ${{ env.CACHE_KEY }}
- name: Set Git config
shell: bash
run: |
Expand All @@ -111,6 +121,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache/restore@v3
name: Restore cache
with:
path: ${{ env.CACHE_PATH }}
key: ${{ env.CACHE_KEY }}
- name: Set Git config
shell: bash
run: |
Expand Down Expand Up @@ -155,6 +170,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache/restore@v3
name: Restore cache
with:
path: ${{ env.CACHE_PATH }}
key: ${{ env.CACHE_KEY }}
- name: Set Git config
shell: bash
run: |
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ repos:
- id: check-toml
- id: debug-statements
- id: end-of-file-fixer
exclude: 'components/renku_data_services/message_queue/(avro_models|schemas)'
- id: mixed-line-ending
- id: trailing-whitespace
exclude: 'components/renku_data_services/message_queue/(avro_models|schemas)'
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
Expand Down
49 changes: 32 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: schemas tests test_setup main_tests schemathesis_tests collect_coverage style_checks pre_commit_checks run download_avro check_avro avro_models update_avro kind_cluster install_amaltheas all
.PHONY: schemas tests test_setup main_tests schemathesis_tests collect_coverage style_checks pre_commit_checks run download_avro check_avro avro_models update_avro k3d_cluster install_amaltheas all

AMALTHEA_JS_VERSION ?= 0.11.0
AMALTHEA_SESSIONS_VERSION ?= 0.0.1-new-operator-chart
AMALTHEA_JS_VERSION ?= 0.12.2
AMALTHEA_SESSIONS_VERSION ?= 0.0.10-new-operator-chart
codegen_params = --input-file-type openapi --output-model-type pydantic_v2.BaseModel --use-double-quotes --target-python-version 3.12 --collapse-root-models --field-constraints --strict-nullable --set-default-enum-member --openapi-scopes schemas paths parameters --set-default-enum-member --use-one-literal-as-default --use-default

define test_apispec_up_to_date
Expand Down Expand Up @@ -38,10 +38,23 @@ components/renku_data_services/notebooks/apispec.py: components/renku_data_servi
poetry run datamodel-codegen --input components/renku_data_services/notebooks/api.spec.yaml --output components/renku_data_services/notebooks/apispec.py --base-class renku_data_services.notebooks.apispec_base.BaseAPISpec $(codegen_params)
components/renku_data_services/platform/apispec.py: components/renku_data_services/platform/api.spec.yaml
poetry run datamodel-codegen --input components/renku_data_services/platform/api.spec.yaml --output components/renku_data_services/platform/apispec.py --base-class renku_data_services.platform.apispec_base.BaseAPISpec $(codegen_params)
components/renku_data_services/data_connectors/apispec.py: components/renku_data_services/data_connectors/api.spec.yaml
poetry run datamodel-codegen --input components/renku_data_services/data_connectors/api.spec.yaml --output components/renku_data_services/data_connectors/apispec.py --base-class renku_data_services.data_connectors.apispec_base.BaseAPISpec $(codegen_params)

##@ Apispec

schemas: components/renku_data_services/crc/apispec.py components/renku_data_services/storage/apispec.py components/renku_data_services/users/apispec.py components/renku_data_services/project/apispec.py components/renku_data_services/namespace/apispec.py components/renku_data_services/secrets/apispec.py components/renku_data_services/connected_services/apispec.py components/renku_data_services/repositories/apispec.py components/renku_data_services/notebooks/apispec.py components/renku_data_services/platform/apispec.py ## Generate pydantic classes from apispec yaml files
schemas: components/renku_data_services/crc/apispec.py \
components/renku_data_services/storage/apispec.py \
components/renku_data_services/users/apispec.py \
components/renku_data_services/project/apispec.py \
components/renku_data_services/session/apispec.py \
components/renku_data_services/namespace/apispec.py \
components/renku_data_services/secrets/apispec.py \
components/renku_data_services/connected_services/apispec.py \
components/renku_data_services/repositories/apispec.py \
components/renku_data_services/notebooks/apispec.py \
components/renku_data_services/platform/apispec.py \
components/renku_data_services/data_connectors/apispec.py ## Generate pydantic classes from apispec yaml files
@echo "generated classes based on ApiSpec"

##@ Avro schemas
Expand Down Expand Up @@ -84,6 +97,8 @@ style_checks: ## Run linting and style checks
@$(call test_apispec_up_to_date,"notebooks")
@echo "checking platform apispec is up to date"
@$(call test_apispec_up_to_date,"platform")
@echo "checking session apispec is up to date"
@$(call test_apispec_up_to_date,"session")
poetry run mypy
poetry run ruff format --check
poetry run ruff check .
Expand Down Expand Up @@ -131,17 +146,17 @@ help: ## Display this help.

##@ Helm/k8s

kind_cluster: ## Creates a kind cluster for testing
kind delete cluster
docker network rm -f kind
docker network create -d=bridge -o com.docker.network.bridge.enable_ip_masquerade=true -o com.docker.network.driver.mtu=1500 --ipv6=false kind
kind create cluster --config kind_config.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
echo "Waiting for ingress controller to initialize"
sleep 15
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s

install_amaltheas: ## Installs both version of amalthea in the currently active k8s context.
k3d_cluster: ## Creates a k3d cluster for testing
k3d cluster delete
k3d cluster create --agents 1 --k3s-arg --disable=metrics-server@server:0

install_amaltheas: ## Installs both version of amalthea in the. NOTE: It uses the currently active k8s context.
helm repo add renku https://swissdatasciencecenter.github.io/helm-charts
helm install amalthea-js renku/amalthea --version $(AMALTHEA_JS_VERSION)
helm install amalthea-sessions renku/amalthea-sessions --version $(AMALTHEA_SESSIONS_VERSION)
helm repo update
helm upgrade --install amalthea-js renku/amalthea --version $(AMALTHEA_JS_VERSION)
helm upgrade --install amalthea-se renku/amalthea-sessions --version ${AMALTHEA_SESSIONS_VERSION}

# TODO: Add the version variables from the top of the file here when the charts are fully published
amalthea_schema: ## Updates generates pydantic classes from CRDs
curl https://raw.githubusercontent.com/SwissDataScienceCenter/amalthea/feat-add-cloud-storage/config/crd/bases/amalthea.dev_amaltheasessions.yaml | yq '.spec.versions[0].schema.openAPIV3Schema' | poetry run datamodel-codegen --input-file-type jsonschema --output-model-type pydantic_v2.BaseModel --output components/renku_data_services/notebooks/cr_amalthea_session.py --use-double-quotes --target-python-version 3.12 --collapse-root-models --field-constraints --strict-nullable --base-class renku_data_services.notebooks.cr_base.BaseCRD --allow-extra-fields --use-default-kwarg
curl https://raw.githubusercontent.com/SwissDataScienceCenter/amalthea/main/controller/crds/jupyter_server.yaml | yq '.spec.versions[0].schema.openAPIV3Schema' | poetry run datamodel-codegen --input-file-type jsonschema --output-model-type pydantic_v2.BaseModel --output components/renku_data_services/notebooks/cr_jupyter_server.py --use-double-quotes --target-python-version 3.12 --collapse-root-models --field-constraints --strict-nullable --base-class renku_data_services.notebooks.cr_base.BaseCRD --allow-extra-fields --use-default-kwarg
42 changes: 34 additions & 8 deletions bases/renku_data_services/data_api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
ResourcePoolUsersBP,
UserResourcePoolsBP,
)
from renku_data_services.data_connectors.blueprints import DataConnectorsBP
from renku_data_services.namespace.blueprints import GroupsBP
from renku_data_services.notebooks.blueprints import NotebooksBP, NotebooksNewBP
from renku_data_services.platform.blueprints import PlatformConfigBP
from renku_data_services.project.blueprints import ProjectsBP
from renku_data_services.repositories.blueprints import RepositoriesBP
from renku_data_services.session.blueprints import EnvironmentsBP, SessionLaunchersBP
from renku_data_services.storage.blueprints import StorageBP, StorageSchemaBP, StoragesV2BP
from renku_data_services.storage.blueprints import StorageBP, StorageSchemaBP
from renku_data_services.users.blueprints import KCUsersBP, UserPreferencesBP, UserSecretsBP


Expand Down Expand Up @@ -74,12 +76,6 @@ def register_all_handlers(app: Sanic, config: Config) -> Sanic:
storage_repo=config.storage_repo,
authenticator=config.gitlab_authenticator,
)
storages_v2 = StoragesV2BP(
name="storages_v2",
url_prefix=url_prefix,
storage_v2_repo=config.storage_v2_repo,
authenticator=config.authenticator,
)
storage_schema = StorageSchemaBP(name="storage_schema", url_prefix=url_prefix)
user_preferences = UserPreferencesBP(
name="user_preferences",
Expand Down Expand Up @@ -134,12 +130,40 @@ def register_all_handlers(app: Sanic, config: Config) -> Sanic:
authenticator=config.authenticator,
internal_gitlab_authenticator=config.gitlab_authenticator,
)
notebooks = NotebooksBP(
name="notebooks_old",
url_prefix=url_prefix,
authenticator=config.authenticator,
nb_config=config.nb_config,
internal_gitlab_authenticator=config.gitlab_authenticator,
git_repo=config.git_repositories_repo,
rp_repo=config.rp_repo,
)
notebooks_new = NotebooksNewBP(
name="notebooks",
url_prefix=url_prefix,
authenticator=config.authenticator,
nb_config=config.nb_config,
project_repo=config.project_repo,
session_repo=config.session_repo,
rp_repo=config.rp_repo,
data_connector_repo=config.data_connector_repo,
data_connector_project_link_repo=config.data_connector_to_project_link_repo,
internal_gitlab_authenticator=config.gitlab_authenticator,
)
platform_config = PlatformConfigBP(
name="platform_config",
url_prefix=url_prefix,
platform_repo=config.platform_repo,
authenticator=config.authenticator,
)
data_connectors = DataConnectorsBP(
name="data_connectors",
url_prefix=url_prefix,
data_connector_repo=config.data_connector_repo,
data_connector_to_project_link_repo=config.data_connector_to_project_link_repo,
authenticator=config.authenticator,
)
app.blueprint(
[
resource_pools.blueprint(),
Expand All @@ -150,7 +174,6 @@ def register_all_handlers(app: Sanic, config: Config) -> Sanic:
user_secrets.blueprint(),
user_resource_pools.blueprint(),
storage.blueprint(),
storages_v2.blueprint(),
storage_schema.blueprint(),
user_preferences.blueprint(),
misc.blueprint(),
Expand All @@ -161,7 +184,10 @@ def register_all_handlers(app: Sanic, config: Config) -> Sanic:
oauth2_clients.blueprint(),
oauth2_connections.blueprint(),
repositories.blueprint(),
notebooks.blueprint(),
notebooks_new.blueprint(),
platform_config.blueprint(),
data_connectors.blueprint(),
]
)

Expand Down
Loading
Loading