Skip to content

Commit

Permalink
Merge #2443
Browse files Browse the repository at this point in the history
2443: Allow "readonly" as alias to "ro" in mount options r=rhatdan a=mariushoch

Apparently docker supports this as well, see [Use a read-only volume](https://docs.docker.com/storage/volumes/#use-a-read-only-volume) in the docker docs.

#### What type of PR is this?

/kind bug

#### What this PR does / why we need it:
To be fully compatible with docker in this regard.

#### How to verify it

With a mount option like `type=bind,source=/var/source,target=/src,readonly`.

```release-note
None
```



Co-authored-by: Marius Hoch <[email protected]>
  • Loading branch information
bors[bot] and mariushoch authored Jul 9, 2020
2 parents 09af114 + ac00f57 commit 42e0fed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ func GetBindMount(args []string) (specs.Mount, error) {
// TODO: detect duplication of these options.
// (Is this necessary?)
newMount.Options = append(newMount.Options, kv[0])
case "readonly":
// Alias for "ro"
newMount.Options = append(newMount.Options, "ro")
case "shared", "rshared", "private", "rprivate", "slave", "rslave", "Z", "z":
newMount.Options = append(newMount.Options, kv[0])
case "bind-propagation":
Expand Down Expand Up @@ -408,6 +411,9 @@ func GetTmpfsMount(args []string) (specs.Mount, error) {
switch kv[0] {
case "ro", "nosuid", "nodev", "noexec":
newMount.Options = append(newMount.Options, kv[0])
case "readonly":
// Alias for "ro"
newMount.Options = append(newMount.Options, "ro")
case "tmpfs-mode":
if len(kv) == 1 {
return newMount, errors.Wrapf(optionArgError, kv[0])
Expand Down

0 comments on commit 42e0fed

Please sign in to comment.