Skip to content

Commit

Permalink
Merge pull request #669 from MetaCell/release/2.1.0
Browse files Browse the repository at this point in the history
Release/2.1.0 back to develop
  • Loading branch information
filippomc authored Jul 31, 2023
2 parents 685f83b + 96019e1 commit 0a5af04
Show file tree
Hide file tree
Showing 77 changed files with 10,143 additions and 1,226 deletions.
12 changes: 11 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ docs
/infrastructure
/blueprint
test
/tools/deployment-cli-tools
.github
.git
.vscode
/deployment
skaffold.yaml
skaffold.yaml
*.egg-info
__pycache__
.hypothesis
.coverage
.pytest_cache
/application-templates
/deployment-configuration
/cloud-harness
.openapi-generator
6 changes: 3 additions & 3 deletions .github/workflows/trivy-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
name: Build
runs-on: "ubuntu-18.04"
runs-on: "ubuntu-20.04"
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Build an image from Dockerfile
run: |
docker build -t cloudharness-base:${{ github.sha }} . -f ./infrastructure/base-images/cloudharness-base/Dockerfile
DOCKER_BUILDKIT=1 docker build -t cloudharness-base:${{ github.sha }} . -f ./infrastructure/base-images/cloudharness-base/Dockerfile
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@2a2157eb22c08c9a1fac99263430307b8d1bc7a2
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ skaffold.yaml
.overrides
/deployment.yaml
.hypothesis
__pycache__
__pycache__
.env
3 changes: 2 additions & 1 deletion application-templates/django-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ WORKDIR ${APP_DIR}
RUN mkdir -p ${APP_DIR}/static/www

COPY backend/requirements.txt ${APP_DIR}
RUN pip3 install --no-cache-dir -r requirements.txt
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip3 install --no-cache-dir -r requirements.txt --prefer-binary

COPY backend/requirements.txt backend/setup.py ${APP_DIR}
RUN python3 -m pip install -e .
Expand Down
3 changes: 2 additions & 1 deletion application-templates/flask-server/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ ENV PORT=8080

COPY requirements.txt /usr/src/app/

RUN pip3 install --no-cache-dir -r requirements.txt
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip3 install --no-cache-dir -r requirements.txt

COPY . /usr/src/app

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ rules:
resources:
- persistentvolumeclaims
verbs:
- get
- list
- create
- delete
- apiGroups:
Expand Down
2 changes: 2 additions & 0 deletions applications/common/server/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ swagger-ui-bundle >= 0.0.2
python_dateutil >= 2.6.0
setuptools >= 21.0.0
Flask == 1.1.2
flask_sqlalchemy==2.4.4
sqlalchemy<2.0.0
3 changes: 2 additions & 1 deletion applications/common/server/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"connexion>=2.0.2",
"swagger-ui-bundle>=0.0.2",
"python_dateutil>=2.6.0",
"psycopg2"
"psycopg2",
"flask_sqlalchemy",
]

setup(
Expand Down
4 changes: 2 additions & 2 deletions applications/events/deploy/resources/broker/server.properties
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ log.retention.hours=-1
zookeeper.connect=zookeeper:2181

# Timeout in ms for connecting to zookeeper
#zookeeper.connection.timeout.ms=6000

zookeeper.connection.timeout.ms=600000
atlas.kafka.zookeeper.session.timeout.ms=600000

############################# Group Coordinator Settings #############################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def camelCaseify(s):
pvc_name_template = get_config("singleuser.storage.dynamic.pvcNameTemplate")
c.KubeSpawner.pvc_name_template = pvc_name_template
volume_name_template = get_config("singleuser.storage.dynamic.volumeNameTemplate")
c.KubeSpawner.storage_pvc_ensure = True
c.KubeSpawner.storage_pvc_ensure = False
set_config_if_not_none(
c.KubeSpawner, "storage_class", "singleuser.storage.dynamic.storageClass"
)
Expand Down Expand Up @@ -524,4 +524,5 @@ def camelCaseify(s):

c.apps = get_config('apps')
c.registry = get_config('registry')
c.domain = get_config('root.domain')
c.domain = get_config('root.domain')
c.namespace = get_config('root.namespace')
4 changes: 4 additions & 0 deletions applications/jupyterhub/deploy/templates/hub/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ spec:
- name: cloudharness-allvalues
configMap:
name: cloudharness-allvalues
{{- if .Values.apps.accounts }}
- name: cloudharness-kc-accounts
secret:
secretName: accounts
{{- end }}
- name: secret
secret:
secretName: {{ include "jupyterhub.hub.fullname" . }}
Expand Down Expand Up @@ -154,9 +156,11 @@ spec:
- name: cloudharness-allvalues
mountPath: /opt/cloudharness/resources/allvalues.yaml
subPath: allvalues.yaml
{{- if .Values.apps.accounts }}
- name: cloudharness-kc-accounts
mountPath: /opt/cloudharness/resources/auth
readOnly: true
{{- end }}
{{- if (include "jupyterhub.hub-existing-secret.fullname" .) }}
- mountPath: /usr/local/etc/jupyterhub/existing-secret/
name: existing-secret
Expand Down
22 changes: 10 additions & 12 deletions applications/jupyterhub/src/chauthenticator/chauthenticator/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,26 @@ def initialize(self, force_new_server, process_user):

@gen.coroutine
def get(self):
raw_user = yield self.get_current_user()
if raw_user:
if self.force_new_server and user.running:
# Stop user's current server if it is running
# so we get a new one.
status = yield raw_user.spawner.poll_and_notify()
if status is None:
yield self.stop_single_user(raw_user)
else:
try:
accessToken = self.request.cookies.get('accessToken', None)
self.clear_login_cookie()

try:

accessToken = self.request.cookies.get(
'kc-access', None) or self.request.cookies.get('accessToken', None)
print("Token", accessToken)
if accessToken == '-1' or not accessToken:
self.redirect('/hub/logout')

accessToken = accessToken.value
user_data = AuthClient.decode_token(accessToken)
username = user_data['sub']
print("Username", username, "-",user_data['preferred_username'])
raw_user = self.user_from_username(username)
print("JH user: ", raw_user.__dict__)
self.set_login_cookie(raw_user)
except Exception as e:
except Exception as e:
logging.error("Error getting user from session", exc_info=True)
raise

user = yield gen.maybe_future(self.process_user(raw_user, self))
self.redirect(self.get_next_url(user))
Expand Down
Loading

0 comments on commit 0a5af04

Please sign in to comment.