// GenerateMounts maps MountPoint paths to volumes, returning a list of Mounts. func GenerateMounts(ra *schema.RuntimeApp, volumes map[types.ACName]types.Volume) []schema.Mount { app := ra.App mnts := make(map[string]schema.Mount) for _, m := range ra.Mounts { mnts[m.Path] = m } for _, mp := range app.MountPoints { // there's already an injected mount for this target path, skip if _, ok := mnts[mp.Path]; ok { continue } vol, ok := volumes[mp.Name] // there is no volume for this mount point, creating an "empty" volume // implicitly if !ok { defaultMode := "0755" defaultUID := 0 defaultGID := 0 emptyVol := types.Volume{ Name: mp.Name, Kind: "empty", Mode: &defaultMode, UID: &defaultUID, GID: &defaultGID, } log.Printf("warning: no volume specified for mount point %q, implicitly creating an \"empty\" volume. This volume will be removed when the pod is garbage-collected.", mp.Name) volumes[mp.Name] = emptyVol ra.Mounts = append(ra.Mounts, schema.Mount{Volume: mp.Name, Path: mp.Path}) } else { ra.Mounts = append(ra.Mounts, schema.Mount{Volume: vol.Name, Path: mp.Path}) } } return ra.Mounts }