fix: honor storage attachment process types at deploy time
An attachment's process type was recorded, reported and used to scope `storage:mount --replace` and `storage:unmount --all`, but nothing read it when the volume was actually mounted, so `storage:mount <app> <entry> --container-dir <path> --process-type web` bound the volume into every process rather than only `web`. Both schedulers now scope a mount to the process type it was declared for, and containers that belong to no process type - a `dokku run` one-off, an `app.json` deploy task, a k3s cron job - receive default-scoped mounts only. A container path can now be claimed by a single mount per process type, and `storage:migrate` drains process-scoped `-v` lines out of `docker-options` rather than only the default-scoped ones.
This commit is contained in:
20 files changed
+1075
-114
No files matched your search
@@ -72,7 +72,9 @@ func reportRunMounts(appName string) string {
|
||||
// registerAttachmentFlags adds one report flag per Attachment field for the
|
||||
// given 1-based index. Host path is resolved from the referenced Entry
|
||||
// (falling back to entry.Name when the entry has no host path, matching
|
||||
// ListAppMountEntries).
|
||||
// ListAppMountEntries). Process type is reported as the scope the attachment
|
||||
// actually deploys under, so a row written before the field existed reads as
|
||||
// _default_ rather than blank.
|
||||
func registerAttachmentFlags(flags map[string]common.ReportFunc, index int, att *Attachment, entry *Entry) {
|
||||
prefix := fmt.Sprintf("--storage-attachment.%d.", index)
|
||||
captured := att
|
||||
@@ -84,7 +86,7 @@ func registerAttachmentFlags(flags map[string]common.ReportFunc, index int, att
|
||||
flags[prefix+"host-path"] = func(string) string { return host }
|
||||
flags[prefix+"container-path"] = func(string) string { return captured.ContainerPath }
|
||||
flags[prefix+"phases"] = func(string) string { return strings.Join(captured.Phases, ",") }
|
||||
flags[prefix+"process-type"] = func(string) string { return captured.ProcessType }
|
||||
flags[prefix+"process-type"] = func(string) string { return captured.EffectiveProcessType() }
|
||||
flags[prefix+"subpath"] = func(string) string { return captured.Subpath }
|
||||
flags[prefix+"readonly"] = func(string) string { return strconv.FormatBool(captured.Readonly) }
|
||||
flags[prefix+"volume-options"] = func(string) string { return captured.VolumeOptions }
|
||||
|
||||
Reference in new issue
Block a user