add --mode flag to run command

This commit is contained in:
Pavel Sviderski
2024-11-23 15:56:03 +10:00
parent 5c1a3dd694
commit df25b0d098
2 changed files with 15 additions and 0 deletions
+10
View File
@@ -22,6 +22,8 @@ type ServiceOptions struct {
Image string
Name string
Machine string
// Mode is the replication mode of the service.
Mode string
Publish []string
}
@@ -39,6 +41,14 @@ func (c *Client) RunService(ctx context.Context, opts *ServiceOptions) (RunServi
return resp, fmt.Errorf("invalid image: %w", err)
}
switch opts.Mode {
case docker.DeployModeReplicated:
case docker.DeployModeGlobal:
return resp, errors.New("global mode is not supported yet")
default:
return resp, fmt.Errorf("invalid mode: %q", opts.Mode)
}
// Find a machine to run the service on.
listResp, err := c.ListMachines(ctx, &emptypb.Empty{})
if err != nil {