Skip to content

Commit ab12fc6

Browse files
authored
Merge pull request #1337 from consideRatio/pr/let-z2jh-seed-hub.services.binder.apiToken
Let z2jh seed jupyterhub.hub.services.binder.apiToken
2 parents 9a871c5 + 06139f0 commit ab12fc6

File tree

6 files changed

+16
-51
lines changed

6 files changed

+16
-51
lines changed

doc/zero-to-binderhub/setup-binderhub.rst

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,11 @@ the container registry. For more information on getting a registry password, see
2727
:ref:`setup-registry`. We'll copy/paste the contents of this file in the steps
2828
below.
2929

30-
Create two random tokens by running the following commands then copying the
31-
outputs.::
32-
33-
openssl rand -hex 32
34-
openssl rand -hex 32
35-
36-
.. note::
37-
38-
This command is run **twice** because we need two different tokens.
39-
4030
Create ``secret.yaml`` file
4131
---------------------------
4232

43-
Create a file called ``secret.yaml`` and add the following::
44-
45-
jupyterhub:
46-
hub:
47-
services:
48-
binder:
49-
apiToken: "<output of FIRST `openssl rand -hex 32` command>"
50-
proxy:
51-
secretToken: "<output of SECOND `openssl rand -hex 32` command>"
52-
53-
Next, we'll configure this file to connect with our registry.
33+
Create a file called ``secret.yaml``, we'll set sensitive values to pass to our
34+
Helm chart in this file.
5435

5536
If you are using ``gcr.io``
5637
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -67,25 +48,18 @@ need to insert. Note that the first line is not indented at all::
6748
# paste the content after `password: |` below
6849
password: |
6950
{
70-
"type": "<REPLACE>",
71-
"project_id": "<REPLACE>",
72-
"private_key_id": "<REPLACE>",
73-
"private_key": "<REPLACE>",
74-
"client_email": "<REPLACE>",
75-
"client_id": "<REPLACE>",
76-
"auth_uri": "<REPLACE>",
77-
"token_uri": "<REPLACE>",
78-
"auth_provider_x509_cert_url": "<REPLACE>",
79-
"client_x509_cert_url": "<REPLACE>"
51+
"type": "<REPLACE>",
52+
"project_id": "<REPLACE>",
53+
"private_key_id": "<REPLACE>",
54+
"private_key": "<REPLACE>",
55+
"client_email": "<REPLACE>",
56+
"client_id": "<REPLACE>",
57+
"auth_uri": "<REPLACE>",
58+
"token_uri": "<REPLACE>",
59+
"auth_provider_x509_cert_url": "<REPLACE>",
60+
"client_x509_cert_url": "<REPLACE>"
8061
}
8162

82-
83-
.. tip::
84-
85-
* The content you put just after ``password: |`` must all line up at the same
86-
tab level.
87-
* Don't forget the ``|`` after the ``password:`` label.
88-
8963
If you are using Docker Hub
9064
~~~~~~~~~~~~~~~~~~~~~~~~~~~
9165

helm-chart/binderhub/templates/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ spec:
9898
- name: JUPYTERHUB_API_TOKEN
9999
valueFrom:
100100
secretKeyRef:
101-
name: binder-secret
102-
key: "binder.hub-token"
101+
name: "{{ include "jupyterhub.hub.fullname" . }}"
102+
key: hub.services.binder.apiToken
103103
{{- if .Values.config.BinderHub.auth_enabled }}
104104
- name: JUPYTERHUB_API_URL
105105
value: {{ (print (.Values.config.BinderHub.hub_url_local | default .Values.config.BinderHub.hub_url | trimSuffix "/") "/hub/api/") }}

helm-chart/binderhub/templates/secret.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ type: Opaque
66
data:
77
{{- $values := dict "config" dict }}
88
{{- $cfg := .Values.config }}
9-
binder.hub-token: {{ .Values.jupyterhub.hub.services.binder.apiToken | required "jupyterhub.hub.services.binder.apiToken must be explicitly set!" | b64enc | quote }}
109
{{- /* every 'pick' here should be matched with a corresponding 'omit' in secret.yaml */ -}}
1110
{{- if $cfg.GitHubRepoProvider }}
1211
{{- $_ := set $values.config "GitHubRepoProvider" (pick $cfg.GitHubRepoProvider "client_id" "client_secret" "access_token") }}

testing/k8s-binder-k8s-hub/binderhub-chart-config.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,10 @@ jupyterhub:
2828
allowOrigin: "*"
2929

3030
hub:
31-
# cookieSecret must be a hex encoded even length string
32-
cookieSecret: "cccccccccc"
3331
db:
3432
type: "sqlite-memory"
35-
services:
36-
binder:
37-
apiToken: "dummy-binder-secret-token"
3833

3934
proxy:
40-
secretToken: "dummy-proxy-secret-token"
4135
service:
4236
type: NodePort
4337
nodePorts:

testing/local-binder-k8s-hub/jupyterhub-chart-config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ custom:
1212
allowOrigin: "*"
1313

1414
hub:
15-
# cookieSecret must be a hex encoded even length string
16-
cookieSecret: "cccccccccc"
1715
db:
1816
type: "sqlite-memory"
1917
services:
2018
binder:
19+
# apiToken is also configured in
20+
# testing/local-binder-k8s-hub/binderhub_config.py
2121
apiToken: "dummy-binder-secret-token"
2222

2323
proxy:
24-
secretToken: "dummy-proxy-secret-token"
2524
service:
2625
type: NodePort
2726
nodePorts:

tools/templates/lint-and-validate-values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ jupyterhub:
7070
services:
7171
binder:
7272
admin: true
73-
apiToken: dummy-binder-secret-token
7473
singleuser:
7574
cmd: jupyter-notebook
7675
events: false

0 commit comments

Comments
 (0)