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

Release/0.7.0 to dev #716

Merged
merged 46 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f5d278c
Release numbering
filippomc Mar 6, 2023
1115c56
#694 fix Searching in 'My Repositories' is searching in all repos
Mar 6, 2023
142c459
repo page scroll fix
filippomc Mar 6, 2023
d65b9c0
#695 fix Click on Open workspace leads to it opening with the default…
Mar 6, 2023
8842fdc
remove console log
Mar 6, 2023
f9be921
Fix cards height
filippomc Mar 6, 2023
12058d4
Merge pull request #698 from OpenSourceBrain/fix-v2-bugs
filippomc Mar 6, 2023
5e1eefa
#699 username in user page url
filippomc Mar 6, 2023
3c12c67
Merge branch 'release/0.7.0' of https://github.com/OpenSourceBrain/OS…
filippomc Mar 6, 2023
a1b132b
new cicd strategy
filippomc Mar 8, 2023
a78170e
new cicd strategy fix
filippomc Mar 8, 2023
138d2cb
#476 refactor user edit
filippomc Mar 14, 2023
6152dc1
#696 netpyne-ui update
filippomc Mar 15, 2023
d50a58c
Build fix
filippomc Mar 15, 2023
f29dd68
Fix Netpyne build
filippomc Mar 15, 2023
60d3921
Use Netpyne master branch
filippomc Mar 15, 2023
3a5bfb0
Fix netpyne build
filippomc Mar 15, 2023
09b39d3
Fix netpyne
filippomc Mar 15, 2023
35b4ff1
Fix netpyne
filippomc Mar 15, 2023
f1ddf1f
Fix netpyne
filippomc Mar 15, 2023
62a2180
#701 change menu order
filippomc Mar 15, 2023
8a63848
#435 implement delete repository
filippomc Mar 16, 2023
d8a3d44
Fix hub backend issues
filippomc Mar 16, 2023
80d7617
Change subdomain from www to app
filippomc Mar 16, 2023
4134d4f
Document user quotas
filippomc Mar 16, 2023
a82d49d
fix 404 calls on ws when no image
filippomc Mar 16, 2023
f57cd16
#693 remove development filter
filippomc Mar 23, 2023
db101f6
Increase nfs disk size
filippomc Mar 23, 2023
de7f9cd
#706 fix workspace page open
filippomc Mar 23, 2023
3c72622
Fix Workspace from repository table size
filippomc Mar 23, 2023
2cec021
#708 fix ws permissions on non-admins
filippomc Mar 23, 2023
bdc7e05
Fix netpyne dockerfile
filippomc Mar 23, 2023
559ca7f
#708 fix regression
filippomc Mar 23, 2023
ef2a83b
#708 fix regression
filippomc Mar 23, 2023
5e761a3
#708 fix regression
filippomc Mar 23, 2023
f42193a
#708 fix regression
filippomc Mar 23, 2023
e61c367
Update dev pipeline
filippomc Mar 23, 2023
04adbdf
Info on readonly workspace
filippomc Mar 23, 2023
2531592
Fix workspaces permissions
filippomc Mar 24, 2023
93ead25
fix test types
filippomc Mar 24, 2023
c65d084
Merge branch 'feature/fixTests' into release/0.7.0
filippomc Mar 24, 2023
d3d4c76
Merge branch 'develop' of https://github.com/OpenSourceBrain/OSBv2 in…
filippomc Mar 24, 2023
3adcc3a
Fix issue with usernames in spawn
filippomc Mar 27, 2023
3abb256
Fix user association to jupyterhub
filippomc Mar 27, 2023
eca1d4f
Fix regression on spawning
filippomc Mar 27, 2023
c3be74f
Fix user pod affinity
filippomc Mar 27, 2023
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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/deployment
.gitignore
/.vscode
.pytest_cache
.pytest_cache
/cloud-harness
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,25 @@ class UserNotFound(Exception): pass
class UserNotAuthorized(Exception): pass


def get_user(userid: str) -> User:
def get_user(username_or_id: str) -> User:
client = AuthClient()
try:
client = AuthClient()
kc_user = client.get_user(userid)

kc_user = client.get_user(username_or_id)

except KeycloakGetError as e:
if e.response_code == 404:
raise UserNotFound(userid)
raise UserNotFound(username_or_id)
raise Exception("Unhandled Keycloak exception") from e
except IndexError:
raise UserNotFound(username_or_id)
except KeycloakError as e:
raise Exception("Unhandled Keycloak exception") from e

user = map_user(kc_user)
try:
current_user = client.get_current_user()
if not current_user or current_user['id'] != userid:
if not current_user or current_user['username'] != username_or_id:
user.email = None
except: # user not provided
log.error("Error checking user", exc_info=True)
Expand Down Expand Up @@ -78,7 +82,7 @@ def update_user(userid, user: User):

try:
current_user = client.get_current_user()
if current_user['id'] != userid != user.id:
if current_user['id'] != user.id:
raise UserNotAuthorized
admin_client = client.get_admin_client()
updated_user = {
Expand Down
45 changes: 35 additions & 10 deletions applications/jupyterhub/src/osb_jupyter/osb_jupyter/jupyterhub.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import sys

import yaml
from jupyterhub.user import User
from kubespawner.spawner import KubeSpawner

from cloudharness.auth import AuthClient
from cloudharness import log
from cloudharness import applications


def affinity_spec(key, value):
Expand Down Expand Up @@ -72,28 +70,37 @@ def workspace_volume_is_legacy(workspace_id):
if not [v for v in self.volumes if v['name'] == volume_name]:
self.volumes.append(ws_pvc)

workspace_owner = get_from_cookie('workspaceOwner')
app_user = get_app_user(self.user)


# Add labels to use for affinity
clean_username = "".join(c for c in app_user.username if c.isalnum())
labels = {
'workspace': str(workspace_id),
'user': self.user.name
'username': clean_username,
'user': str(self.user.id),
}

appname = self.image.split('/')[-1].split(':')[0]

self.common_labels = labels
self.extra_labels = labels
self.storage_class = f'{self.config["namespace"]}-nfs-client'

if not user_volume_is_legacy(self.user.id):
# User pod affinity is by default added by cloudharness
self.pod_affinity_required = []


workspace = get_workspace(workspace_id, get_from_cookie("accessToken"))
write_access = has_user_write_access(
workspace_id, self.user, workspace_owner)
workspace, self.user, app_user=app_user)

if workspace_volume_is_legacy(workspace_id):
# Pods with write access must be on the same node
self.pod_affinity_required.append(affinity_spec('workspace', workspace_id))
from pprint import pprint
pprint(self.volumes)
self.pod_name = f'ws-{clean_username}-{workspace_id}-{appname}'
if not [v for v in self.volume_mounts if v['name'] == volume_name]:
self.volume_mounts.append({
'name': volume_name,
Expand All @@ -104,10 +111,28 @@ def workspace_volume_is_legacy(workspace_id):
log.error('Change pod manifest failed due to an error.', exc_info=True)


def get_app_user(user: User):
auth_client = AuthClient()
kc_user = auth_client.get_user(user.name)
return kc_user

def has_user_write_access(workspace, user: User, app_user=None):
print('Checking access, name:', user.name, "workspace:", workspace["id"])

def has_user_write_access(workspace_id, user: User, workspace_owner: str):
print('name:', user.name, workspace_owner)

workspace_owner = workspace["user"]["id"]
print("Workspace owner", workspace_owner, "-", workspace["user"]["username"])

if workspace_owner == user.name:
return True
auth_client = AuthClient()
return auth_client.user_has_realm_role(user.name, 'administrator')
return auth_client.user_has_realm_role(app_user.id, 'administrator')

def get_workspace(workspace_id, token, workspace_base_url=None):
if workspace_base_url is None:
workspace_conf: applications.ApplicationConfiguration = applications.get_configuration('workspaces')
workspace_base_url = workspace_conf.get_service_address()
import requests
workspace = requests.get(f"{workspace_base_url}/api/workspace/{workspace_id}", headers={"Authorization": f"Bearer {token}"}).json()

return workspace
13 changes: 7 additions & 6 deletions applications/netpyne/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM node:13.14 as jsbuild
ENV REPO=https://github.com/MetaCell/NetPyNE-UI.git
ENV BRANCH_TAG=osb2-dev
ENV FOLDER=netpyne
RUN echo "no-cache 2023-1-9"
RUN echo "no-cache 2023-3-15b"
RUN git clone $REPO -b $BRANCH_TAG $FOLDER
RUN rm -Rf .git

Expand All @@ -13,9 +13,8 @@ RUN yarn install --network-timeout 1000000000
RUN yarn build-dev


RUN mv node_modules/@metacell .
RUN rm -Rf node_modules/*
RUN mv @metacell node_modules
RUN mv node_modules/@metacell . && rm -Rf node_modules/* && mv @metacell node_modules


###
FROM jupyter/base-notebook:hub-1.4.2
Expand Down Expand Up @@ -52,7 +51,7 @@ RUN jupyter nbextension enable --py --sys-prefix jupyter_geppetto
RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension
RUN jupyter serverextension enable --py --sys-prefix jupyter_geppetto

RUN python utilities/install.py --npm-skip --netpyne $NETPYNE_CORE_BRANCH_TAG --workspace=
RUN python utilities/install.py --npm-skip --netpyne $NETPYNE_CORE_BRANCH_TAG



Expand All @@ -70,12 +69,14 @@ COPY overrides/hub/jupyter_notebook_config.py /etc/jupyter/jupyter_notebook_conf
RUN rm -f ~/.jupyter/*.json
RUN chown $NB_UID .
RUN chown $NB_UID /opt
RUN wget -P `pip show LFPykit | grep "Location:" | awk '{print $2"/lfpykit"}'` https://www.parralab.org/nyhead/sa_nyhead.mat
RUN rm -Rf workspace
# RUN wget -P `pip show LFPykit | grep "Location:" | awk '{print $2"/lfpykit"}'` https://www.parralab.org/nyhead/sa_nyhead.mat
USER $NB_UID

# sym link workspace pvc to $FOLDER
RUN mkdir -p /opt/workspace
RUN mkdir -p /opt/user

RUN ln -s /opt/workspace workspace

ENV NEURON_HOME=/opt/conda
Expand Down
2 changes: 2 additions & 0 deletions applications/nfsserver/deploy/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nfs:
useDNS: true
4 changes: 4 additions & 0 deletions applications/nfsserver/deploy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# nfs server pvc disk size (/exports)
server:
diskSize: 20Gi
2 changes: 1 addition & 1 deletion applications/osb-portal/deploy/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
harness:
subdomain: www
subdomain: app
secured: false
deployment:
auto: true
Expand Down
Loading