apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "jupyterlab.configMapName" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "jupyterlab.labels" . | nindent 4 }}
data:
  startup-script.sh: |
    #!/bin/bash
    apt-get update -y
    python -m pip install --no-cache-dir --upgrade pip
  jupyter_server_config.py: |
    # Idle kernel culling
    # idleCullTimeout=0: culling disabled; positive value: seconds before shutdown
    c.MappingKernelManager.cull_idle_timeout = {{ int .Values.jupyterConfig.idleCullTimeout }}
    c.MappingKernelManager.cull_interval = {{ int .Values.jupyterConfig.idleCullInterval }}
    # Do not cull kernels that have an active connection (browser tab open)
    c.MappingKernelManager.cull_connected = False
