Skip to content
Snippets Groups Projects
Commit 0ad4bf8c authored by Tim Kreuzer's avatar Tim Kreuzer
Browse files

Merge branch 'blocklist-repo' into 'main'

add blocklist git repo and make hub restart schedule configurable

See merge request !6
parents f0c9bc81 5e360a64
Branches
No related tags found
1 merge request!6add blocklist git repo and make hub restart schedule configurable
Pipeline #253681 passed
......@@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.16.9
version: 0.16.10
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
......
......@@ -11,6 +11,7 @@ data:
# Variables used for git clone commands
SHARE_BASE_DIR="/tmp/share_base"
SHARE_OVERLAYS_DIR="/tmp/share_overlays"
SHARE_BLOCKLIST_DIR="/tmp/share_blocklist"
# Prepare base + overlays in this directory, before moving it to /mnt/shared-data
SHARE_COPY_DIR="/tmp/share_copy"
......@@ -23,13 +24,22 @@ data:
SHARE_NGINX_DIR="/mnt/shared-data/static-files"
mkdir -p ${SHARE_NGINX_DIR}
# In this directory Jupyterhub will look for the blocklist files
SHARE_JHUB_BLOCKLIST="/mnt/shared-data/blocklist"
mkdir -p ${SHARE_JHUB_BLOCKLIST}
# create temporary folders
mkdir -p $(dirname ${SHARE_BASE_DIR})
mkdir -p $(dirname ${SHARE_BLOCKLIST_DIR})
if [[ -e ${SHARE_BASE_DIR} ]]; then
rm -rf ${SHARE_BASE_DIR}
fi
if [[ -e ${SHARE_BLOCKLIST_DIR} ]]; then
rm -rf ${SHARE_BLOCKLIST_DIR}
fi
cd $(dirname ${SHARE_BASE_DIR})
if [[ -n ${SHARE_BASE_GIT_USERNAME} && -n ${SHARE_BASE_GIT_PASSWORD} ]]; then
git clone --single-branch --branch ${SHARE_BASE_GIT_BRANCH} https://${SHARE_BASE_GIT_USERNAME}:${SHARE_BASE_GIT_PASSWORD}@${SHARE_BASE_GIT_REPO#"https://"} $(basename ${SHARE_BASE_DIR})
......@@ -37,6 +47,13 @@ data:
git clone --single-branch --branch ${SHARE_BASE_GIT_BRANCH} https://${SHARE_BASE_GIT_REPO#"https://"} $(basename ${SHARE_BASE_DIR})
fi
cd $(dirname ${SHARE_BLOCKLIST_DIR})
if [[ -n ${GIT_BLOCKLIST_USERNAME} && -n ${GIT_BLOCKLIST_PASSWORD} ]]; then
git clone --single-branch --branch ${GIT_BLOCKLIST_BRANCH} https://${GIT_BLOCKLIST_USERNAME}:${GIT_BLOCKLIST_PASSWORD}@${GIT_BLOCKLIST_REPO#"https://"} $(basename ${SHARE_BLOCKLIST_DIR})
else
git clone --single-branch --branch ${GIT_BLOCKLIST_BRANCH} ${GIT_BLOCKLIST_REPO} $(basename ${SHARE_BLOCKLIST_DIR})
fi
if [[ -n ${SHARE_OVERLAYS_GIT_REPO} ]]; then
mkdir -p $(dirname ${SHARE_OVERLAYS_DIR})
......@@ -117,6 +134,15 @@ data:
chown -R 1000:1000 ${SHARE_NGINX_DIR}
rm -rf ${SHARE_COPY_DIR}
fi
SHARE_BLOCKLIST_UPDATED=$(check_git_update ${SHARE_BLOCKLIST_DIR})
if [[ ${SHARE_BLOCKLIST_UPDATED} -eq 1 || ${FORCE} -eq 1 ]]; then
echo "$(date) - Blocklist update detected"
cd ${SHARE_BLOCKLIST_DIR}
git pull origin ${GIT_BLOCKLIST_BRANCH}
cp -r ${SHARE_BLOCKLIST_DIR}/* ${SHARE_JHUB_BLOCKLIST}/.
fi
}
update force
......
......@@ -8,7 +8,7 @@ metadata:
release: jupyterhub
{{- include "jupyter-hub-customizations.labels" . | nindent 4 }}
spec:
schedule: "0 3 * * *"
schedule: {{ .Values.dailyRestart.restartSchedule }}
jobTemplate:
spec:
template:
......
......@@ -32,6 +32,7 @@ livenessProbe:
dailyRestart:
enabled: true
restartSchedule: "0 3 * * *"
jupyter-metrics:
enabled: false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment