chore: do not set default volume driver to local, distinguish behaviour when it's set or not

This commit is contained in:
Pavel Sviderski
2025-04-21 16:53:43 +10:00
parent 835c310987
commit 143e68cc95
9 changed files with 128 additions and 55 deletions
+12 -6
View File
@@ -51,12 +51,18 @@ func (cli *Client) RunService(ctx context.Context, spec api.ServiceSpec) (api.Ru
// Create the missing volumes on the scheduled machines.
for machineID, volumes := range scheduledVolumes {
for _, v := range volumes {
_, err = cli.CreateVolume(ctx, machineID, volume.CreateOptions{
Name: v.Name,
Driver: v.VolumeOptions.Driver.Name,
DriverOpts: v.VolumeOptions.Driver.Options,
})
if err != nil {
opts := volume.CreateOptions{
Name: v.Name,
}
if v.VolumeOptions != nil {
if v.VolumeOptions.Driver != nil {
opts.Driver = v.VolumeOptions.Driver.Name
opts.DriverOpts = v.VolumeOptions.Driver.Options
}
opts.Labels = v.VolumeOptions.Labels
}
if _, err = cli.CreateVolume(ctx, machineID, opts); err != nil {
return resp, fmt.Errorf("create volume '%s': %w", v.Name, err)
}
}