api: Parse CSI Volumes

Previously when deserializing volumes we skipped over volumes that were
not of type `host`. This commit ensures that we parse both host and csi
volumes correctly.
This commit is contained in:
Danielle Lancashire 2020-02-07 10:21:56 +01:00 committed by Tim Gross
parent e56c677221
commit 15c6c05ccf

View file

@ -749,8 +749,9 @@ func ApiTgToStructsTG(taskGroup *api.TaskGroup, tg *structs.TaskGroup) {
if l := len(taskGroup.Volumes); l != 0 { if l := len(taskGroup.Volumes); l != 0 {
tg.Volumes = make(map[string]*structs.VolumeRequest, l) tg.Volumes = make(map[string]*structs.VolumeRequest, l)
for k, v := range taskGroup.Volumes { for k, v := range taskGroup.Volumes {
if v.Type != structs.VolumeTypeHost { if v.Type != structs.VolumeTypeHost && v.Type != structs.VolumeTypeCSI {
// Ignore non-host volumes in this iteration currently. // Ignore volumes we don't understand in this iteration currently.
// - This is because we don't currently have a way to return errors here.
continue continue
} }