mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
refactor: postpone spec resolver initialisation when creating Deployment
This commit is contained in:
@@ -96,7 +96,7 @@ func runDeploy(ctx context.Context, uncli *cli.CLI, opts deployOptions) error {
|
||||
filter = machineFilter(machines)
|
||||
}
|
||||
|
||||
d, err := clusterClient.NewCaddyDeployment(ctx, opts.image, filter)
|
||||
d, err := clusterClient.NewCaddyDeployment(opts.image, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create caddy deployment: %w", err)
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ func add(ctx context.Context, uncli *cli.CLI, remoteMachine cli.RemoteMachine, o
|
||||
}
|
||||
}
|
||||
|
||||
d, err := machineClient.NewCaddyDeployment(ctx, caddyImage, filter)
|
||||
d, err := machineClient.NewCaddyDeployment(caddyImage, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create caddy deployment: %w", err)
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ func initCluster(ctx context.Context, uncli *cli.CLI, remoteMachine *cli.RemoteM
|
||||
}
|
||||
|
||||
if !opts.noCaddy {
|
||||
d, err := client.NewCaddyDeployment(ctx, "", nil)
|
||||
d, err := client.NewCaddyDeployment("", nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create caddy deployment: %w", err)
|
||||
}
|
||||
|
||||
@@ -88,12 +88,7 @@ func scale(ctx context.Context, uncli *cli.CLI, opts scaleOptions) error {
|
||||
}
|
||||
|
||||
spec.Replicas = opts.replicas
|
||||
|
||||
deployment, err := clusterClient.NewDeployment(ctx, spec, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create deployment: %w", err)
|
||||
}
|
||||
|
||||
deployment := clusterClient.NewDeployment(spec, nil)
|
||||
plan, err := deployment.Plan(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("plan deployment: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user