mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
refactor: decouple deploy and compose packages from client dependency
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
"github.com/psviderski/uncloud/internal/machine/api/pb"
|
||||
"github.com/psviderski/uncloud/pkg/api"
|
||||
"github.com/psviderski/uncloud/pkg/client"
|
||||
"github.com/psviderski/uncloud/pkg/deploy"
|
||||
"github.com/spf13/cobra"
|
||||
"slices"
|
||||
"strings"
|
||||
@@ -89,7 +89,7 @@ func run(ctx context.Context, uncli *cli.CLI, opts runOptions) error {
|
||||
return fmt.Errorf("invalid replication mode: %q", opts.mode)
|
||||
}
|
||||
|
||||
var machineFilter client.MachineFilter
|
||||
var machineFilter deploy.MachineFilter
|
||||
if len(opts.machines) > 0 {
|
||||
var machines []string
|
||||
for _, value := range opts.machines {
|
||||
|
||||
@@ -89,12 +89,8 @@ func scale(ctx context.Context, uncli *cli.CLI, opts scaleOptions) error {
|
||||
|
||||
spec.Replicas = opts.replicas
|
||||
|
||||
deploy, err := clusterClient.NewDeployment(spec, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create deployment: %w", err)
|
||||
}
|
||||
|
||||
plan, err := deploy.Plan(ctx)
|
||||
deployment := clusterClient.NewDeployment(spec, nil)
|
||||
plan, err := deployment.Plan(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("plan deployment: %w", err)
|
||||
}
|
||||
@@ -128,7 +124,7 @@ func scale(ctx context.Context, uncli *cli.CLI, opts scaleOptions) error {
|
||||
|
||||
title := fmt.Sprintf("Scaling service %s (%d → %d replicas)", svc.Name, currentReplicas, opts.replicas)
|
||||
err = progress.RunWithTitle(ctx, func(ctx context.Context) error {
|
||||
if _, err = deploy.Run(ctx); err != nil {
|
||||
if _, err = deployment.Run(ctx); err != nil {
|
||||
return fmt.Errorf("deploy service: %w", err)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user