diff --git a/runsc/boot/mount_hints.go b/runsc/boot/mount_hints.go index 794356d61..373a84a2d 100644 --- a/runsc/boot/mount_hints.go +++ b/runsc/boot/mount_hints.go @@ -99,12 +99,12 @@ func newPodMountHints(spec *specs.Spec) (*podMountHints, error) { mnts[name] = mnt } if err := mnt.setField(parts[1], v); err != nil { - return nil, err + log.Warningf("ignoring invalid mount annotation (name = %q, key = %q, value = %q): %v", name, parts[1], v, err) } } } - // Validate all hints after done parsing. + // Validate all the parsed hints. for name, m := range mnts { log.Infof("Mount annotation found, name: %s, source: %q, type: %s, share: %v", name, m.mount.Source, m.mount.Type, m.share) if m.share == invalid { diff --git a/runsc/boot/mount_hints_test.go b/runsc/boot/mount_hints_test.go index 8330df462..16dc83d12 100644 --- a/runsc/boot/mount_hints_test.go +++ b/runsc/boot/mount_hints_test.go @@ -120,13 +120,6 @@ func TestPodMountHintsErrors(t *testing.T) { }, error: "share field", }, - { - name: "invalid field name", - annotations: map[string]string{ - MountPrefix + "mount1.invalid": "foo", - }, - error: "invalid mount annotation", - }, { name: "invalid source", annotations: map[string]string{ @@ -134,7 +127,7 @@ func TestPodMountHintsErrors(t *testing.T) { MountPrefix + "mount1.type": "tmpfs", MountPrefix + "mount1.share": "pod", }, - error: "source cannot be empty", + error: "source field for \"mount1\" has not been set", }, { name: "invalid type", @@ -143,7 +136,7 @@ func TestPodMountHintsErrors(t *testing.T) { MountPrefix + "mount1.type": "invalid-type", MountPrefix + "mount1.share": "pod", }, - error: "invalid type", + error: "type field for \"mount1\" has not been set", }, { name: "invalid share", @@ -152,17 +145,7 @@ func TestPodMountHintsErrors(t *testing.T) { MountPrefix + "mount1.type": "tmpfs", MountPrefix + "mount1.share": "invalid-share", }, - error: "invalid share", - }, - { - name: "invalid options", - annotations: map[string]string{ - MountPrefix + "mount1.source": "foo", - MountPrefix + "mount1.type": "tmpfs", - MountPrefix + "mount1.share": "pod", - MountPrefix + "mount1.options": "invalid-option", - }, - error: "unknown mount option", + error: "share field for \"mount1\" has not been set", }, { name: "duplicate source",