summaryrefslogtreecommitdiff
path: root/vendor/jupyter/values.yaml
blob: ca95682858cedebc814d247d2908eb42226a0c67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
rbac:
  enabled: false

hub:
  extraEnv:
    JUPYTER_ENABLE_LAB: 1
  extraConfig: |
    c.KubeSpawner.cmd = ['jupyter-labhub']
    c.GitLabOAuthenticator.scope = ['api read_repository write_repository']

    async def add_auth_env(spawner):
      '''
      We set user's id, login and access token on single user image to
      enable repository integration for JupyterHub.
      See: https://gitlab.com/gitlab-org/gitlab-ce/issues/47138#note_154294790
      '''
      auth_state = await spawner.user.get_auth_state()

      if not auth_state:
          spawner.log.warning("No auth state for %s", spawner.user)
          return

      spawner.environment['GITLAB_ACCESS_TOKEN'] = auth_state['access_token']
      spawner.environment['GITLAB_USER_LOGIN'] = auth_state['gitlab_user']['username']
      spawner.environment['GITLAB_USER_ID'] = str(auth_state['gitlab_user']['id'])
      spawner.environment['GITLAB_USER_EMAIL'] = auth_state['gitlab_user']['email']
      spawner.environment['GITLAB_USER_NAME'] = auth_state['gitlab_user']['name']

    c.KubeSpawner.pre_spawn_hook = add_auth_env

auth:
  type: gitlab
  state:
    enabled: true

singleuser:
  defaultUrl: "/lab"
  image:
    name: registry.gitlab.com/gitlab-org/jupyterhub-user-image
    tag: latest
  lifecycleHooks:
    postStart:
      exec:
        command:
          - "sh"
          - "-c"
          - >
            git clone https://gitlab.com/gitlab-org/nurtch-demo.git DevOps-Runbook-Demo || true;
            echo "https://oauth2:${GITLAB_ACCESS_TOKEN}@${GITLAB_HOST}" > ~/.git-credentials;
            git config --global credential.helper store;
            git config --global user.email "${GITLAB_USER_EMAIL}";
            git config --global user.name "${GITLAB_USER_NAME}";
            jupyter serverextension enable --py jupyterlab_git

ingress:
 enabled: true
 annotations:
   kubernetes.io/ingress.class: "nginx"
   kubernetes.io/tls-acme: "true"

proxy:
  service:
    type: NodePort
    nodePorts:
      http: 30080
      https: 30443