Skip to content

Commit

Permalink
validation should allow attachment/access mode for host volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Dec 17, 2024
1 parent 0491707 commit 80e3481
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions nomad/structs/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,22 @@ func (v *VolumeRequest) Validate(jobType string, taskGroupCount, canaries int) e
switch v.Type {

case VolumeTypeHost:
if v.AttachmentMode != CSIVolumeAttachmentModeUnknown {
addErr("host volumes cannot have an attachment mode")
}
if v.AccessMode != CSIVolumeAccessModeUnknown {
addErr("host volumes cannot have an access mode")
}
if v.MountOptions != nil {
// TODO(1.10.0): support mount options for dynamic host volumes
addErr("host volumes cannot have mount options")
}

switch v.AccessMode {
case CSIVolumeAccessModeSingleNodeReader, CSIVolumeAccessModeMultiNodeReader:
if !v.ReadOnly {
addErr("%s volumes must be read-only", v.AccessMode)
}
default:
// dynamic host volumes are all "per node" so there's no way to
// validate that other access modes work for a given volume until we
// have access to other allocations (in the scheduler)
}

case VolumeTypeCSI:

switch v.AttachmentMode {
Expand Down

0 comments on commit 80e3481

Please sign in to comment.