diff --git a/pkg/systemd/quadlet/quadlet.go b/pkg/systemd/quadlet/quadlet.go index 2f791eec33..86b94fa0e8 100644 --- a/pkg/systemd/quadlet/quadlet.go +++ b/pkg/systemd/quadlet/quadlet.go @@ -1186,14 +1186,10 @@ func ConvertVolume(volume *parser.UnitFile, unitsInfoMap map[string]*UnitInfo, i mountOpts, ok := volume.Lookup(VolumeGroup, KeyOptions) if ok && len(mountOpts) != 0 { - if devValid { - if opts.Len() > 2 { - opts.WriteString(",") - } - opts.WriteString(mountOpts) - } else { - return nil, warnings, fmt.Errorf("key Options can't be used without Device") + if opts.Len() > 2 { + opts.WriteString(",") } + opts.WriteString(mountOpts) } } diff --git a/test/e2e/quadlet/mount-options.volume b/test/e2e/quadlet/mount-options.volume new file mode 100644 index 0000000000..088f23d4c6 --- /dev/null +++ b/test/e2e/quadlet/mount-options.volume @@ -0,0 +1,7 @@ +## assert-last-key-contains Service ExecStart " --opt o=uid=0,gid=11,rw,compress=zstd " + +[Volume] +# Test usernames too +User=root +Group=11 +Options=rw,compress=zstd diff --git a/test/e2e/quadlet_test.go b/test/e2e/quadlet_test.go index c44b6f4099..5295100aaf 100644 --- a/test/e2e/quadlet_test.go +++ b/test/e2e/quadlet_test.go @@ -1017,6 +1017,7 @@ BOGUS=foo Entry("Volume - global args", "globalargs.volume"), Entry("Volume - Containers Conf Modules", "containersconfmodule.volume"), Entry("Volume - Type=bind", "device-bind.volume"), + Entry("mount-options.volume", "mount-options.volume"), Entry("Absolute Path", "absolute.path.kube"), Entry("Basic kube", "basic.kube"),