# https://ucsd-prp.gitlab.io/userdocs/development/jupyterhub/
hub:
  config:
    CILogonOAuthenticator:
      client_id: cilogon:/client_id/76c3f7eb194ad6ef6c22a92ce1b54d89
      client_secret: t_zrDuJRlJX4LZhUCrk3iPMwG9MKKuveHZMzqINyET3RfidDEvAnkNRHhYC1NiRtShsThwF0cy4vzLNorNw4-Q
      oauth_callback_url: https://csusb-hub-project.nrp-nautilus.io/hub/oauth_callback
      username_claim: "email"
      allowed_idps: ["csusb.edu"]
    JupyterHub:
      admin_access: true
      admin_users: ["dvu@csusb.edu", "000065181@csusb.edu", "youngsu.kim@csusb.edu", "006501270@csusb.edu"]
      authenticator_class: cilogon
      #Restricts access to csusb domains 
      #allowed_idps command may change its funtionality after update 
      #https://github.com/jupyterhub/oauthenticator/issues/494
      allowed_idps: ["csusb.edu"]

# initContainers for custom htmls
  initContainers:
    - name: git-clone-templates
      image: alpine/git
      args:
        - clone
        - --single-branch
        - --branch=main
        - --depth=1
        - --
        - https://gitlab.nrp-nautilus.io/csusb-prp/csusb-jupyterhub-templates.git
        - /etc/jupyterhub/custom
      securityContext:
        runAsUser: 0
      volumeMounts:
        - name: custom-templates
          mountPath: /etc/jupyterhub/custom
  extraVolumes:
    - name: custom-templates
      emptyDir: {}
  extraVolumeMounts:
    - name: custom-templates
      mountPath: /etc/jupyterhub/custom
  extraConfig:
    templates: |
      c.JupyterHub.template_paths = ['/etc/jupyterhub/custom']

# https://github.com/jupyterhub/zero-to-jupyterhub-k8s/issues/1990
  extraFiles:
    image_select_idp:
      mountPath: /usr/local/share/jupyterhub/static/select_idp_cilogon.png

    # Files in /usr/local/etc/jupyterhub/jupyterhub_config.d are
    # automatically loaded in alphabetical order of the final file
    # name when JupyterHub starts.

    # for dynamic resource allocation 
    custom_spawner:
      mountPath: /usr/local/etc/jupyterhub/jupyterhub_config.d/my_spawner.py
    # Custom profiles list for the spawner above
    custom_spawner_profile:
      mountPath: /etc/jupyterhub/custom/my_spawner.html

  service:
    type: ClusterIP
    annotations: {}
    ports:
      nodePort:
    loadBalancerIP:
  deploymentStrategy:
    type: Recreate
  db:
    type: sqlite-pvc
    pvc:
      accessModes:
        - ReadWriteOnce
      storage: 2Gi
      storageClassName: rook-ceph-block
  resources:
    limits:
      cpu: "2"
      memory: 1Gi
    requests:
      cpu: 100m
      memory: 512Mi
  networkPolicy:
    enabled: false
proxy:
  secretToken: "795cb91892686a06560e9532d2b073b4cdbe102e92ea2b25496e3ae76f240c09"
  service:
    type: ClusterIP
  chp:
    resources:
      limits:
        cpu: "2"
        memory: 1Gi
      requests:
        cpu: 200m
        memory: 512Mi
singleuser:
  extraNodeAffinity:
    required:
      - matchExpressions:
        - 'key': 'topology.kubernetes.io/region'
          'operator': 'In'
          'values': ["us-west"]
        # - 'key': 'nvidia.com/cuda.runtime.major'
        #   'operator': 'In'
        #   'values': ["11"]   
        # - 'key': 'nvidia.com/cuda.runtime.minor'
        #   'operator': 'In'
        #   'values': ["4"] 
        # - 'key': 'kubernetes.io/hostname'
        #   'operator': 'In' 
        #   'values': ['fiona8-0.calit2.uci.edu','fiona8-1.calit2.uci.edu','fiona8-2.calit2.uci.edu','fiona8-3.calit2.uci.edu']
  cloudMetadata:
    blockWithIptables: false
  networkPolicy:
    enabled: false
  storage:
    type: dynamic
    extraLabels: {}
    # extraVolumes: []
    # extraVolumeMounts: []
    capacity: 5Gi
    homeMountPath: /home/jovyan
    dynamic:
      storageClass: rook-ceph-block
      pvcNameTemplate: claim-{username}{servername}
      volumeNameTemplate: volume-{username}{servername}
      storageAccessModes: [ReadWriteOnce]
    # extraVolumes:
    #   - name: csusb-hub-project-share
    #     persistentVolumeClaim:
    #       claimName: csusb-hub-project-share
    # extraVolumeMounts:
    #   - name: csusb-hub-project-share
    #     mountPath: /home/jovyan/shared        
  image:
    name: localhost:30081/prp/jupyter-stack/prp
    tag: latest
  startTimeout: 600
  cpu:
    limit: 1
    guarantee: 1
  memory:
    limit: 2G
    guarantee: 2G
  extraResource:
    limits: {}
    guarantees: {}
  cmd: jupyterhub-singleuser
  defaultUrl: "/lab"

  # This list is overriden by extraFile
  profileList:
  - display_name: Stack Minimal
    kubespawner_override:
      image_spec: localhost:30081/prp/jupyter-stack/minimal
      # extra_resource_limits:
      #   nvidia.com/gpu: {}
    # default: True
  - display_name: Stack Minimal no GPU
    kubespawner_override:
      image_spec: localhost:30081/prp/jupyter-stack/minimal
      # extra_resource_limits:
        # nvidia.com/gpu: "1"
    # default: True
  
scheduling:
  userScheduler:
    enabled: false
# prePuller relates to the hook|continuous-image-puller DaemonsSets
prePuller:
  hook:
    enabled: false
  continuous:
    enabled: false

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: haproxy
  hosts: ["csusb-hub-project.nrp-nautilus.io"]
  pathSuffix: ''
  tls:
    - hosts:
      - csusb-hub-project.nrp-nautilus.io

cull:
  enabled: true
  users: false
  removeNamedServers: false
  timeout: 3600
  every: 600
  concurrency: 10
  maxAge: 0