Skip to content

Commit

Permalink
extraFiles: rename mountPath to mountDir
Browse files Browse the repository at this point in the history
mountPath in k8s Secrets imply the need to declare the file name as well
when a subPath is used. So it feels a bit more clear to name this option
mountDir, leaving less doubt about the interpretation.
  • Loading branch information
consideRatio committed Jan 27, 2021
1 parent 0c45f15 commit f49bda0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions dev-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,32 @@ hub:
extraFiles:
my_config:
name: my_config.py
mountPath: /etc/jupyterhub.d
mountDir: /etc/jupyterhub.d
stringData: |
with open("/tmp/created-by-extra-files-config.txt", "w") as f:
f.write("hello world!")
binaryData.txt: &binaryData
mountPath: /tmp/
mountDir: /tmp/
mode: 0666
binaryData: |
aGVsbG8gd
29ybGQhCg==
binaryData-explicit-name.txt: &binaryData2
name: binaryData.txt
mountPath: /tmp/dir1
mountDir: /tmp/dir1
mode: 0666
binaryData: aGVsbG8gd29ybGQhCg==
stringData.txt: &stringData
mountPath: /tmp
mountDir: /tmp
mode: 0666
stringData: hello world!
stringData-explicit-name.txt: &stringData2
name: stringData.txt
mountPath: /tmp/dir1/
mountDir: /tmp/dir1/
mode: 0666
stringData: hello world!
data.yaml: &data
mountPath: /etc/test
mountDir: /etc/test
mode: 0444
data:
config:
Expand Down
2 changes: 1 addition & 1 deletion jupyterhub/files/hub/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def camelCaseify(s):
file_name = file_details.get("name", file_key)
volume_mounts.append(
{
"mountPath": file_details["mountPath"].rstrip("/") + "/" + file_name,
"mountPath": file_details["mountDir"].rstrip("/") + "/" + file_name,
"subPath": file_key,
"name": "files",
}
Expand Down
8 changes: 4 additions & 4 deletions jupyterhub/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ properties:
# (example: 256).
mode: <file system permissions>
# mountPath is required and must be the directory you want to
# mountDir is required and must be the directory you want to
# mount the file.
mountPath: <directory path>
mountDir: <directory path>
# Choose one out of the three ways to represent the actual file
# content: data, stringData, or binaryData.
Expand Down Expand Up @@ -276,13 +276,13 @@ properties:
# as it can hamper our ability to use --set-file.
my_image:
name: my_image.png
mountPath: /usr/local/share/jupyterhub/static/
mountDir: /usr/local/share/jupyterhub/static/
# Files in /etc/jupyterhub.d are automatically loaded just like
# hub.extraConfig entries, sorted based on their name.
my_config:
name: my_jupyterhub_config.py
mountPath: /etc/jupyterhub.d
mountDir: /etc/jupyterhub.d
```
```bash
Expand Down
2 changes: 1 addition & 1 deletion jupyterhub/templates/hub/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ spec:
name: secret
{{- range $file_key, $file_details := .Values.hub.extraFiles }}
{{- $file_name := $file_details.name | default $file_key }}
- mountPath: {{ $file_details.mountPath | trimSuffix "/" }}/{{ $file_name }}
- mountPath: {{ $file_details.mountDir | trimSuffix "/" }}/{{ $file_name }}
subPath: {{ $file_key | quote }}
name: files
{{- end }}
Expand Down
10 changes: 5 additions & 5 deletions tools/templates/lint-and-validate-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ imagePullSecrets: [a, b]
hub:
extraFiles:
binaryData.txt:
mountPath: /tmp/
mountDir: /tmp/
mode: 0666
binaryData: aGVsbG8gd29ybGQhCg== # "hello world!" base64 encoded
binaryData-explicit-name.txt:
name: binaryData.txt
mountPath: /tmp/dir1
mountDir: /tmp/dir1
mode: 0666
binaryData: aGVsbG8gd29ybGQhCg== # "hello world!" base64 encoded
stringData.txt:
mountPath: /tmp
mountDir: /tmp
mode: 0666
stringData: hello world!
stringData-explicit-name.txt:
name: stringData.txt
mountPath: /tmp/dir1/
mountDir: /tmp/dir1/
mode: 0666
stringData: hello world!
data.yaml: &data
mountPath: /tmp
mountDir: /tmp
mode: 0666
data:
config:
Expand Down

0 comments on commit f49bda0

Please sign in to comment.