Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/pytorchjob-generator/chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ customize the Jobs generated by the tool.
| sshGitCloneConfig | object | `nil` | Private GitHub clone support. See [values.yaml](values.yaml) for additional instructions. |
| setupCommands | array | no custom commands are executed | List of custom commands to be ran at the beginning of the execution. Use `setupCommand` to clone code, download data, and change directories. |
| mainProgram | string | `nil` | Name of the PyTorch program to be executed by `torchrun`. Please provide your program name here and NOT in "setupCommands" as this helm template provides the necessary "torchrun" arguments for the parallel execution. WARNING: this program is relative to the current path set by change-of-directory commands in "setupCommands". If no value is provided; then only `setupCommands` are executed and torchrun is elided. |
| volumes | array | No volumes are mounted | List of "(name, claimName, mountPath)" of volumes, with persistentVolumeClaim, to be mounted to the infrastructure |
| volumes | array | No volumes are mounted | List of volumes to mount, each with a 'name', a 'mountPath', and a volume source. The 'claimName' shorthand mounts a PersistentVolumeClaim. For any other source, give the volume source verbatim as a [Kubernetes volume](https://kubernetes.io/docs/concepts/storage/volumes/#volume-types) field (e.g. 'secret', 'configMap', 'emptyDir', ...). |

### Advanced Options

Expand Down
10 changes: 9 additions & 1 deletion tools/pytorchjob-generator/chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,16 @@ volumes:
{{- end }}
{{- range $volume := .Values.volumes }}
- name: {{ required "Missing 'name' in 'volumes' list element" $volume.name }}
{{- if $volume.claimName }}
persistentVolumeClaim:
claimName: {{ required "Missing 'claimName' in 'volumes' list element" $volume.claimName }}
claimName: {{ $volume.claimName }}
{{- else }}
{{- $source := omit $volume "name" "mountPath" }}
{{- if not $source }}
{{ required "A 'volumes' list element needs 'claimName' or a volume source (e.g. 'secret', 'configMap', ...)" nil }}
{{- end }}
{{- toYaml $source | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.sshGitCloneConfig }}
- name: private-ssh-git-deploy-key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ Adding Volume Mounts:
name: arbitrary-name-0
- mountPath: /path/to/where/you/want/to/find/your/data-redux
name: arbitrary-name-1
- mountPath: /run/whole-secret
name: whole-secret
- mountPath: /run/secrets/.mc
name: secret-with-items
- mountPath: /etc/cfg
name: configmap-vol
- mountPath: /dev/shm
name: dshm
imagePullSecrets: []
Expand All @@ -83,6 +89,18 @@ Adding Volume Mounts:
- name: arbitrary-name-1
persistentVolumeClaim:
claimName: name-matching-another-actual-PersistentVolumeClaim
- name: whole-secret
secret:
secretName: my-secret
- name: secret-with-items
secret:
items:
- key: config.json
path: config.json
secretName: my-cos-config
- configMap:
name: my-configmap
name: configmap-vol
- emptyDir:
medium: Memory
name: dshm
Expand Down Expand Up @@ -140,6 +158,12 @@ Adding Volume Mounts:
name: arbitrary-name-0
- mountPath: /path/to/where/you/want/to/find/your/data-redux
name: arbitrary-name-1
- mountPath: /run/whole-secret
name: whole-secret
- mountPath: /run/secrets/.mc
name: secret-with-items
- mountPath: /etc/cfg
name: configmap-vol
- mountPath: /dev/shm
name: dshm
imagePullSecrets: []
Expand All @@ -151,6 +175,18 @@ Adding Volume Mounts:
- name: arbitrary-name-1
persistentVolumeClaim:
claimName: name-matching-another-actual-PersistentVolumeClaim
- name: whole-secret
secret:
secretName: my-secret
- name: secret-with-items
secret:
items:
- key: config.json
path: config.json
secretName: my-cos-config
- configMap:
name: my-configmap
name: configmap-vol
- emptyDir:
medium: Memory
name: dshm
Expand Down
15 changes: 15 additions & 0 deletions tools/pytorchjob-generator/chart/tests/helloworld_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,21 @@ tests:
- name: arbitrary-name-1
claimName: name-matching-another-actual-PersistentVolumeClaim
mountPath: /path/to/where/you/want/to/find/your/data-redux
- name: whole-secret
mountPath: /run/whole-secret
secret:
secretName: my-secret
- name: secret-with-items
mountPath: /run/secrets/.mc
secret:
secretName: my-cos-config
items:
- key: config.json
path: config.json
- name: configmap-vol
mountPath: /etc/cfg
configMap:
name: my-configmap
asserts:
- matchSnapshot:
path: spec.components[0].template
Expand Down
20 changes: 16 additions & 4 deletions tools/pytorchjob-generator/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,28 @@ setupCommands: # <optional, default=[]>
# @section -- Workload Specification
mainProgram: # <optional, default="">

# -- (array) List of "(name, claimName, mountPath)" of volumes, with persistentVolumeClaim, to be mounted to the infrastructure
# -- (array) List of volumes to mount, each with a 'name', a 'mountPath', and a volume source. The 'claimName' shorthand mounts a PersistentVolumeClaim. For any other source, give the volume source verbatim as a [Kubernetes volume](https://kubernetes.io/docs/concepts/storage/volumes/#volume-types) field (e.g. 'secret', 'configMap', 'emptyDir', ...).
# @default -- No volumes are mounted
# @section -- Workload Specification
volumes:
# - name: arbitrary-name-0
# - name: arbitrary-name-0 # 'claimName' shorthand for a PersistentVolumeClaim
# claimName: name-matching-the-actual-PersistentVolumeClaim
# mountPath: /path/to/where/you/want/to/find/your/data
# - name: arbitrary-name-1
# claimName: name-matching-another-actual-PersistentVolumeClaim
# - name: arbitrary-name-1 # the same, given as a verbose volume source
# mountPath: /path/to/where/you/want/to/find/your/data-redux
# persistentVolumeClaim:
# claimName: name-matching-another-actual-PersistentVolumeClaim
# - name: arbitrary-name-2 # mount a configMap
# mountPath: /path/to/where/you/want/to/find/your/data
# configMap:
# name: name-matching-the-actual-ConfigMap
# - name: arbitrary-name-3 # mount only selected keys of a secret
# mountPath: /path/to/where/you/want/to/find/your/data
# secret:
# secretName: name-matching-the-actual-Secret
# items:
# - key: config.json
# path: config.json

# ------------------------------------------------------------------------------------------------
# Advanced options begin here
Expand Down
Loading