diff --git a/charts/jupyter-hub-customizations/Chart.yaml b/charts/jupyter-hub-customizations/Chart.yaml index da119df8e8c6761c1b20dd70a00de2651572fe3a..dca563669449798d717615604dd450c545965323 100644 --- a/charts/jupyter-hub-customizations/Chart.yaml +++ b/charts/jupyter-hub-customizations/Chart.yaml @@ -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. diff --git a/charts/jupyter-hub-customizations/templates/configmap_check_frontend_files.yaml b/charts/jupyter-hub-customizations/templates/configmap_check_frontend_files.yaml index 312174aee07ffdb1c2f86e74626fafb0bb5c753e..5c0cf4e924dd11e1e04fa28f2eebca5d17a6f4af 100644 --- a/charts/jupyter-hub-customizations/templates/configmap_check_frontend_files.yaml +++ b/charts/jupyter-hub-customizations/templates/configmap_check_frontend_files.yaml @@ -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 diff --git a/charts/jupyter-hub-customizations/templates/cron_job_restart_hub.yaml b/charts/jupyter-hub-customizations/templates/cron_job_restart_hub.yaml index 761af749381a2a4caa69d6e526e12bc54cfbaae4..1f17c825a0380e742adf659a72d79db8ac69bec5 100644 --- a/charts/jupyter-hub-customizations/templates/cron_job_restart_hub.yaml +++ b/charts/jupyter-hub-customizations/templates/cron_job_restart_hub.yaml @@ -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: diff --git a/charts/jupyter-hub-customizations/values.yaml b/charts/jupyter-hub-customizations/values.yaml index ee0004173c6c737cc0a9dd02755fb942d1d83d06..5826a7a3fcfff32165304cab6e75d03d51bcb66a 100644 --- a/charts/jupyter-hub-customizations/values.yaml +++ b/charts/jupyter-hub-customizations/values.yaml @@ -32,6 +32,7 @@ livenessProbe: dailyRestart: enabled: true + restartSchedule: "0 3 * * *" jupyter-metrics: enabled: false