Explorar o código

Merge pull request #23523 from vieux/fix_mounts_swarm

fix 2 potential panics with mounts in swarm
Brian Goff %!s(int64=9) %!d(string=hai) anos
pai
achega
87f31e379d
Modificáronse 2 ficheiros con 4 adicións e 1 borrados
  1. 3 0
      api/client/service/opts.go
  2. 1 1
      daemon/cluster/executor/container/adapter.go

+ 3 - 0
api/client/service/opts.go

@@ -154,6 +154,9 @@ func (m *MountOpt) Set(value string) error {
 				Labels: make(map[string]string),
 			}
 		}
+		if mount.VolumeOptions.DriverConfig == nil {
+			mount.VolumeOptions.DriverConfig = &swarm.Driver{}
+		}
 		return mount.VolumeOptions
 	}
 

+ 1 - 1
daemon/cluster/executor/container/adapter.go

@@ -192,7 +192,7 @@ func (c *containerAdapter) createVolumes(ctx context.Context, backend executorpk
 			continue
 		}
 
-		if mount.VolumeOptions != nil {
+		if mount.VolumeOptions == nil {
 			continue
 		}