Skip to content

Commit a831d3a

Browse files
committed
feat(job): Rename --gcsfuse-mount-options to --mount-options, add validation and update docs
1 parent 81a29e0 commit a831d3a

4 files changed

Lines changed: 18 additions & 6 deletions

File tree

cmd/job/submit.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ var (
7979
pathwaysWorkerEnv []string
8080
validEnvKeyRegex = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$")
8181

82-
gcsfuseMountOptions string
82+
mountOptions string
8383
)
8484

8585
var SubmitCmd = &cobra.Command{
@@ -125,6 +125,14 @@ and JobSet/Kueue specific configurations like workload name, queue, nodes, and r
125125

126126
priorityClassName = strings.ToLower(priorityClassName)
127127

128+
if mountOptions != "" {
129+
for _, m := range volumeStr {
130+
if !strings.HasPrefix(m, "gs://") {
131+
return fmt.Errorf("--mount-options is currently only supported for GCS fuse volumes (gs://...)")
132+
}
133+
}
134+
}
135+
128136
return nil
129137
},
130138
SilenceUsage: true,
@@ -140,6 +148,7 @@ func init() {
140148
SubmitCmd.Flags().StringVarP(&platform, "platform", "f", "linux/amd64", "Target platform for the image build (e.g., 'linux/amd64', 'linux/arm64'). Used with --base-image.")
141149

142150
SubmitCmd.Flags().StringSliceVar(&volumeStr, "mount", nil, "Volumes to mount (format: <src>:<dest>[:<mode>], mode can be 'ro' or 'rw', default 'ro').")
151+
SubmitCmd.Flags().StringVar(&mountOptions, "mount-options", "", "Mount options for all volumes (currently only supported for GCS fuse volumes, e.g., 'logging:severity:info,enable-atomic-rename-object:true').")
143152
SubmitCmd.Flags().StringArrayVar(&envVars, "env", []string{}, "Custom environment variables to pass to the workload container in KEY=VALUE format. Can be specified multiple times.")
144153

145154
SubmitCmd.Flags().StringVarP(&workloadName, "name", "n", "", "Name of the workload to create. Required.")
@@ -165,7 +174,6 @@ func init() {
165174
SubmitCmd.Flags().BoolVar(&verbose, "verbose", false, "Enable verbose logging for the workload (TPUs and GPUs).")
166175
SubmitCmd.Flags().StringVar(&gkeNapProvisioning, "gke-nap-provisioning", "", "Compute provisioning model for GKE NAP. Allowed values: on-demand, spot, reservation.")
167176
SubmitCmd.Flags().StringVar(&gkeNapReservation, "gke-nap-reservation", "", "Name of the Google Cloud Reservation for GKE NAP (required if --gke-nap-provisioning=reservation).")
168-
SubmitCmd.Flags().StringVar(&gcsfuseMountOptions, "gcsfuse-mount-options", "", "GCSFuse mount options for all GCS mounts (e.g., 'logging:severity:info,enable-atomic-rename-object:true').")
169177

170178
SubmitCmd.Flags().BoolVar(&isPathwaysJob, "pathways", false, "If present, gcluster will generate a manifest for a Pathways job.")
171179
SubmitCmd.Flags().StringVar(&pathways.ProxyServerImage, "pathways-proxy-server-image", "", "The image for the Pathways proxy server.")
@@ -261,7 +269,7 @@ func runSubmitCmd(cmd *cobra.Command, args []string) error {
261269
IsPathwaysJob: isPathwaysJob,
262270
Pathways: pathways,
263271
RawMounts: volumeStr,
264-
GCSFuseMountOptions: gcsfuseMountOptions,
272+
MountOptions: mountOptions,
265273
Env: parseEnvFlags(envVars),
266274
Verbose: verbose,
267275
}

docs/gcluster_job_guide.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ You can mount Cloud Storage buckets, Filestore instances, existing PVCs (e.g., f
164164
Mounts must use the format: `--mount "<src>:<dest>[:<mode>]"`
165165
* `mode` is optional and defaults to `ro` (read-only). To allow writes, append `:rw`.
166166

167+
You can also pass custom mount options to GCS fuse volumes using the `--mount-options` flag.
168+
167169
**Supported volume sources (`<src>`):**
168170
* **Cloud Storage**: `gs://<bucket-name>` (mounts via GCS Fused Driver)
169171
* **Filestore**: `filestore://<instance-name-or-ip>/<share-name>` (auto-provisions PV and PVC)
@@ -187,7 +189,8 @@ Mounting a GCS bucket (read-write):
187189
--compute-type n2-standard-32 \
188190
--base-image python:3.9-slim \
189191
--build-context job_details \
190-
--mount "gs://<YOUR_BUCKET_NAME>:/data:rw"
192+
--mount "gs://<YOUR_BUCKET_NAME>:/data:rw" \
193+
--mount-options "logging:severity:info,enable-atomic-rename-object:true"
191194
```
192195
193196
Mounting an existing PVC named `lustre-pvc` (read-only):
@@ -1095,6 +1098,7 @@ The `gcluster job submit` command deploys a container image as a job (Kubernetes
10951098
| `--num-nodes` | `int` | Number of nodes to use per group/slice (Default: `1`). Auto-calculated for TPUs based on topology. |
10961099
| `--restarts` | `int` | Maximum number of restarts allowed for the JobSet before marked as failed (Default: `1`). |
10971100
| `--mount` | `stringArray` | Mount storage volumes, buckets, filestore instances, or PVCs using the `<src>:<dest>[:<mode>]` format. Examples of `<src>`: `gs://my-bucket`, `filestore://my-instance/share`, `my-pvc` (for Lustre/etc), or `/host/path`. |
1101+
| `--mount-options` | `string` | Custom mount options for attached volumes (currently only supported for GCS fuse volumes, e.g., `logging:severity:info,enable-atomic-rename-object:true`). |
10981102
| `--env` | `stringArray` | Custom environment variables to pass exclusively to the user's workload container in KEY=VALUE format (e.g. `--env KEY=VALUE`). Applies to both standard and Pathways workloads. Can be specified multiple times. |
10991103
| `--await-job-completion` | `bool` | If true, the CLI waits for the job to complete before exiting. |
11001104
| `--timeout` | `string` | Time to wait for job completion (e.g., `1h`, `10m`). Used with `--await-job-completion`. |

pkg/orchestrator/gke/storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (sm *StorageManager) ProcessMounts(mounts []string, job orchestrator.JobDef
7373
ReadOnly: readOnly,
7474
}
7575
if volType == "gcsfuse" {
76-
mountInfo.Options = job.GCSFuseMountOptions
76+
mountInfo.Options = job.MountOptions
7777
}
7878
mountInfos = append(mountInfos, mountInfo)
7979
}

pkg/orchestrator/orchestrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ type JobDefinition struct {
9999
Pathways PathwaysJobDefinition // Embedded struct for Pathways-specific args
100100

101101
RawMounts []string
102-
GCSFuseMountOptions string
102+
MountOptions string
103103
Env map[string]string
104104

105105
Verbose bool

0 commit comments

Comments
 (0)