Skip to content

Commit 3c8f51d

Browse files
committed
chore: move cli formatters and version modules to machinery
To be used in the `go-talos-support` module without importing the whole Talos repo. Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
1 parent 8152a6d commit 3c8f51d

File tree

43 files changed

+67
-58
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+67
-58
lines changed

cmd/installer/cmd/installer/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/siderolabs/talos/cmd/installer/pkg/install"
1616
"github.com/siderolabs/talos/internal/app/machined/pkg/runtime/v1alpha1/platform"
1717
"github.com/siderolabs/talos/pkg/machinery/config/configloader"
18-
"github.com/siderolabs/talos/pkg/version"
18+
"github.com/siderolabs/talos/pkg/machinery/version"
1919
)
2020

2121
// installCmd represents the installation command.

cmd/installer/pkg/install/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/siderolabs/talos/internal/pkg/mount"
2626
"github.com/siderolabs/talos/pkg/machinery/constants"
2727
"github.com/siderolabs/talos/pkg/machinery/kernel"
28-
"github.com/siderolabs/talos/pkg/version"
28+
"github.com/siderolabs/talos/pkg/machinery/version"
2929
)
3030

3131
// Options represents the set of options available for an install.

cmd/installer/pkg/install/preflight.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/siderolabs/talos/pkg/machinery/constants"
2323
"github.com/siderolabs/talos/pkg/machinery/resources/k8s"
2424
"github.com/siderolabs/talos/pkg/machinery/role"
25-
"github.com/siderolabs/talos/pkg/version"
25+
"github.com/siderolabs/talos/pkg/machinery/version"
2626
)
2727

2828
// PreflightChecks runs the preflight checks.

cmd/talosctl/cmd/mgmt/cluster/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ import (
4545
"github.com/siderolabs/talos/pkg/machinery/config/types/v1alpha1"
4646
"github.com/siderolabs/talos/pkg/machinery/constants"
4747
"github.com/siderolabs/talos/pkg/machinery/nethelpers"
48+
"github.com/siderolabs/talos/pkg/machinery/version"
4849
"github.com/siderolabs/talos/pkg/provision"
4950
"github.com/siderolabs/talos/pkg/provision/access"
5051
"github.com/siderolabs/talos/pkg/provision/providers"
51-
"github.com/siderolabs/talos/pkg/version"
5252
)
5353

5454
const (

cmd/talosctl/cmd/talos/inspect.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/siderolabs/talos/cmd/talosctl/pkg/talos/helpers"
1515
"github.com/siderolabs/talos/pkg/cli"
1616
"github.com/siderolabs/talos/pkg/machinery/client"
17+
"github.com/siderolabs/talos/pkg/machinery/formatters"
1718
)
1819

1920
// inspectCmd represents the inspect command.
@@ -54,7 +55,7 @@ to render the graph:
5455
cli.Warning("%s", err)
5556
}
5657

57-
return cli.RenderGraph(ctx, c, resp, os.Stdout, inspectDependenciesCmdFlags.withResources)
58+
return formatters.RenderGraph(ctx, c, resp, os.Stdout, inspectDependenciesCmdFlags.withResources)
5859
})
5960
},
6061
}

cmd/talosctl/cmd/talos/mounts.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515

1616
"github.com/siderolabs/talos/pkg/cli"
1717
"github.com/siderolabs/talos/pkg/machinery/client"
18+
"github.com/siderolabs/talos/pkg/machinery/formatters"
1819
)
1920

2021
// mountsCmd represents the mounts command.
@@ -37,7 +38,7 @@ var mountsCmd = &cobra.Command{
3738
cli.Warning("%s", err)
3839
}
3940

40-
return cli.RenderMounts(resp, os.Stdout, &remotePeer)
41+
return formatters.RenderMounts(resp, os.Stdout, &remotePeer)
4142
})
4243
},
4344
}

cmd/talosctl/cmd/talos/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import (
2020
"google.golang.org/grpc/peer"
2121

2222
"github.com/siderolabs/talos/cmd/talosctl/pkg/talos/global"
23-
"github.com/siderolabs/talos/pkg/cli"
2423
_ "github.com/siderolabs/talos/pkg/grpc/codec" // register codec
2524
"github.com/siderolabs/talos/pkg/machinery/api/common"
2625
machineapi "github.com/siderolabs/talos/pkg/machinery/api/machine"
2726
"github.com/siderolabs/talos/pkg/machinery/client"
2827
"github.com/siderolabs/talos/pkg/machinery/constants"
28+
"github.com/siderolabs/talos/pkg/machinery/formatters"
2929
)
3030

3131
var kubernetes bool
@@ -165,7 +165,7 @@ func getServiceFromNode() []string {
165165

166166
for _, msg := range resp.Messages {
167167
for _, s := range msg.Services {
168-
svc := cli.ServiceInfoWrapper{ServiceInfo: s}
168+
svc := formatters.ServiceInfoWrapper{ServiceInfo: s}
169169
svcIDs = append(svcIDs, svc.Id)
170170
}
171171
}

cmd/talosctl/cmd/talos/service.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616

1717
"github.com/siderolabs/talos/pkg/cli"
1818
"github.com/siderolabs/talos/pkg/machinery/client"
19+
"github.com/siderolabs/talos/pkg/machinery/formatters"
1920
)
2021

2122
// serviceCmd represents the service command.
@@ -89,7 +90,7 @@ func serviceList(ctx context.Context, c *client.Client) error {
8990

9091
for _, msg := range resp.Messages {
9192
for _, s := range msg.Services {
92-
svc := cli.ServiceInfoWrapper{ServiceInfo: s}
93+
svc := formatters.ServiceInfoWrapper{ServiceInfo: s}
9394

9495
node := defaultNode
9596

@@ -122,7 +123,7 @@ func serviceInfo(ctx context.Context, c *client.Client, id string) error {
122123
return fmt.Errorf("service %q is not registered on any nodes", id)
123124
}
124125

125-
return cli.RenderServicesInfo(services, os.Stdout, defaultNode, true)
126+
return formatters.RenderServicesInfo(services, os.Stdout, defaultNode, true)
126127
}
127128

128129
func serviceStart(ctx context.Context, c *client.Client, id string) error {

cmd/talosctl/cmd/talos/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/siderolabs/talos/pkg/images"
2727
"github.com/siderolabs/talos/pkg/machinery/api/machine"
2828
"github.com/siderolabs/talos/pkg/machinery/client"
29-
"github.com/siderolabs/talos/pkg/version"
29+
"github.com/siderolabs/talos/pkg/machinery/version"
3030
)
3131

3232
var upgradeCmdFlags struct {

cmd/talosctl/cmd/talos/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
"github.com/siderolabs/talos/pkg/cli"
1818
"github.com/siderolabs/talos/pkg/machinery/client"
19-
"github.com/siderolabs/talos/pkg/version"
19+
"github.com/siderolabs/talos/pkg/machinery/version"
2020
)
2121

2222
// versionCmdFlags represents the `talosctl version` command's flags.

cmd/talosctl/pkg/mgmt/helpers/image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"fmt"
99
"os"
1010

11-
"github.com/siderolabs/talos/pkg/version"
11+
"github.com/siderolabs/talos/pkg/machinery/version"
1212
)
1313

1414
// DefaultImage appends default image version.

cmd/talosctl/pkg/talos/helpers/checks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
"github.com/siderolabs/talos/pkg/machinery/api/common"
1818
"github.com/siderolabs/talos/pkg/machinery/client"
19-
"github.com/siderolabs/talos/pkg/version"
19+
"github.com/siderolabs/talos/pkg/machinery/version"
2020
)
2121

2222
// FailIfMultiNodes checks if ctx contains multi-node request metadata.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ require (
5656
github.com/docker/go-connections v0.5.0
5757
github.com/dustin/go-humanize v1.0.1
5858
github.com/ecks/uefi v0.0.0-20221116212947-caef65d070eb
59-
github.com/emicklei/dot v1.6.1
6059
github.com/fatih/color v1.16.0
6160
github.com/foxboron/go-uefi v0.0.0-20240128152106-48be911532c2
6261
github.com/freddierice/go-losetup/v2 v2.0.1
@@ -215,6 +214,7 @@ require (
215214
github.com/docker/docker-credential-helpers v0.7.0 // indirect
216215
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
217216
github.com/docker/go-units v0.5.0 // indirect
217+
github.com/emicklei/dot v1.6.1 // indirect
218218
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
219219
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
220220
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect

internal/app/apid/pkg/backend/apid_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
"github.com/siderolabs/talos/pkg/machinery/config"
3333
"github.com/siderolabs/talos/pkg/machinery/proto"
3434
"github.com/siderolabs/talos/pkg/machinery/role"
35-
"github.com/siderolabs/talos/pkg/version"
35+
"github.com/siderolabs/talos/pkg/machinery/version"
3636
)
3737

3838
type APIDSuite struct {

internal/app/init/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"github.com/siderolabs/talos/internal/pkg/secureboot/tpm2"
3030
"github.com/siderolabs/talos/pkg/machinery/constants"
3131
"github.com/siderolabs/talos/pkg/machinery/extensions"
32-
"github.com/siderolabs/talos/pkg/version"
32+
"github.com/siderolabs/talos/pkg/machinery/version"
3333
)
3434

3535
func init() {

internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ import (
8787
"github.com/siderolabs/talos/pkg/machinery/resources/network"
8888
timeresource "github.com/siderolabs/talos/pkg/machinery/resources/time"
8989
"github.com/siderolabs/talos/pkg/machinery/role"
90-
"github.com/siderolabs/talos/pkg/version"
90+
"github.com/siderolabs/talos/pkg/machinery/version"
9191
)
9292

9393
// MinimumEtcdUpgradeLeaseLockSeconds indicates the minimum number of seconds for which we open a lease lock for upgrading Etcd nodes.

internal/app/machined/pkg/controllers/cluster/discovery_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"github.com/siderolabs/talos/pkg/machinery/resources/kubespan"
3131
"github.com/siderolabs/talos/pkg/machinery/resources/network"
3232
"github.com/siderolabs/talos/pkg/machinery/resources/runtime"
33-
"github.com/siderolabs/talos/pkg/version"
33+
"github.com/siderolabs/talos/pkg/machinery/version"
3434
)
3535

3636
const defaultDiscoveryTTL = 30 * time.Minute

internal/app/machined/pkg/controllers/cluster/local_affiliate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/siderolabs/talos/pkg/machinery/resources/k8s"
2626
"github.com/siderolabs/talos/pkg/machinery/resources/kubespan"
2727
"github.com/siderolabs/talos/pkg/machinery/resources/network"
28-
"github.com/siderolabs/talos/pkg/version"
28+
"github.com/siderolabs/talos/pkg/machinery/version"
2929
)
3030

3131
// LocalAffiliateController builds Affiliate resource for the local node.

internal/app/machined/pkg/controllers/cluster/local_affiliate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"github.com/siderolabs/talos/pkg/machinery/resources/k8s"
2424
"github.com/siderolabs/talos/pkg/machinery/resources/kubespan"
2525
"github.com/siderolabs/talos/pkg/machinery/resources/network"
26-
"github.com/siderolabs/talos/pkg/version"
26+
"github.com/siderolabs/talos/pkg/machinery/version"
2727
)
2828

2929
type LocalAffiliateSuite struct {

internal/app/machined/pkg/controllers/siderolink/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
"github.com/siderolabs/talos/pkg/machinery/resources/network"
3939
"github.com/siderolabs/talos/pkg/machinery/resources/runtime"
4040
"github.com/siderolabs/talos/pkg/machinery/resources/siderolink"
41-
"github.com/siderolabs/talos/pkg/version"
41+
"github.com/siderolabs/talos/pkg/machinery/version"
4242
)
4343

4444
// ManagerController interacts with SideroLink API and brings up the SideroLink Wireguard interface.

internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/grub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"path/filepath"
1212

1313
"github.com/siderolabs/talos/pkg/machinery/constants"
14-
"github.com/siderolabs/talos/pkg/version"
14+
"github.com/siderolabs/talos/pkg/machinery/version"
1515
)
1616

1717
// Config represents a grub configuration file (grub.cfg).

internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/grub_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"github.com/stretchr/testify/require"
2020

2121
"github.com/siderolabs/talos/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub"
22-
"github.com/siderolabs/talos/pkg/version"
22+
"github.com/siderolabs/talos/pkg/machinery/version"
2323
)
2424

2525
var (

internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ import (
7878
"github.com/siderolabs/talos/pkg/machinery/resources/k8s"
7979
resourceruntime "github.com/siderolabs/talos/pkg/machinery/resources/runtime"
8080
resourcev1alpha1 "github.com/siderolabs/talos/pkg/machinery/resources/v1alpha1"
81+
"github.com/siderolabs/talos/pkg/machinery/version"
8182
"github.com/siderolabs/talos/pkg/minimal"
82-
"github.com/siderolabs/talos/pkg/version"
8383
)
8484

8585
// WaitForUSB represents the WaitForUSB task.

internal/app/maintenance/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
v1alpha1machine "github.com/siderolabs/talos/pkg/machinery/config/machine"
3636
"github.com/siderolabs/talos/pkg/machinery/constants"
3737
"github.com/siderolabs/talos/pkg/machinery/role"
38-
"github.com/siderolabs/talos/pkg/version"
38+
"github.com/siderolabs/talos/pkg/machinery/version"
3939
)
4040

4141
// Server implements [machine.MachineServiceServer], network.NetworkService, and [storage.StorageServiceServer].

internal/integration/cli/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"regexp"
1111

1212
"github.com/siderolabs/talos/internal/integration/base"
13-
"github.com/siderolabs/talos/pkg/version"
13+
"github.com/siderolabs/talos/pkg/machinery/version"
1414
)
1515

1616
// VersionSuite verifies version command.

internal/integration/integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import (
2525
"github.com/siderolabs/talos/pkg/images"
2626
clientconfig "github.com/siderolabs/talos/pkg/machinery/client/config"
2727
"github.com/siderolabs/talos/pkg/machinery/constants"
28+
"github.com/siderolabs/talos/pkg/machinery/version"
2829
"github.com/siderolabs/talos/pkg/provision"
2930
"github.com/siderolabs/talos/pkg/provision/providers"
30-
"github.com/siderolabs/talos/pkg/version"
3131
)
3232

3333
// Accumulated list of all the suites to run.

internal/integration/k8s/tink.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import (
3939
"github.com/siderolabs/talos/pkg/machinery/config/generate"
4040
"github.com/siderolabs/talos/pkg/machinery/config/machine"
4141
"github.com/siderolabs/talos/pkg/machinery/constants"
42-
"github.com/siderolabs/talos/pkg/version"
42+
"github.com/siderolabs/talos/pkg/machinery/version"
4343
)
4444

4545
// TinkSuite verifies Talos-in-Kubernetes.

internal/integration/provision/provision.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ import (
4444
"github.com/siderolabs/talos/pkg/machinery/config/types/v1alpha1"
4545
"github.com/siderolabs/talos/pkg/machinery/constants"
4646
"github.com/siderolabs/talos/pkg/machinery/nethelpers"
47+
"github.com/siderolabs/talos/pkg/machinery/version"
4748
"github.com/siderolabs/talos/pkg/provision"
4849
"github.com/siderolabs/talos/pkg/provision/access"
4950
"github.com/siderolabs/talos/pkg/provision/providers/qemu"
50-
"github.com/siderolabs/talos/pkg/version"
5151
)
5252

5353
var allSuites []suite.TestingSuite

internal/pkg/extensions/extensions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/stretchr/testify/require"
1414

1515
"github.com/siderolabs/talos/internal/pkg/extensions"
16-
"github.com/siderolabs/talos/pkg/version"
16+
"github.com/siderolabs/talos/pkg/machinery/version"
1717
)
1818

1919
func TestLoadValidate(t *testing.T) {

internal/pkg/extensions/validate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/blang/semver/v4"
1515

1616
"github.com/siderolabs/talos/pkg/machinery/extensions"
17-
"github.com/siderolabs/talos/pkg/version"
17+
"github.com/siderolabs/talos/pkg/machinery/version"
1818
)
1919

2020
// Validate the extension: compatibility, contents, etc.

internal/pkg/secureboot/uki/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"github.com/siderolabs/talos/internal/pkg/secureboot"
1818
"github.com/siderolabs/talos/internal/pkg/secureboot/measure"
1919
"github.com/siderolabs/talos/pkg/machinery/constants"
20+
"github.com/siderolabs/talos/pkg/machinery/version"
2021
"github.com/siderolabs/talos/pkg/splash"
21-
"github.com/siderolabs/talos/pkg/version"
2222
)
2323

2424
func (builder *Builder) generateOSRel() error {

internal/pkg/tui/installer/installer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/siderolabs/talos/internal/pkg/tui/components"
1919
machineapi "github.com/siderolabs/talos/pkg/machinery/api/machine"
2020
clientconfig "github.com/siderolabs/talos/pkg/machinery/client/config"
21-
"github.com/siderolabs/talos/pkg/version"
21+
"github.com/siderolabs/talos/pkg/machinery/version"
2222
)
2323

2424
// NewPage creates a new installer page.

pkg/cluster/sonobuoy/product.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package sonobuoy
66

7-
import "github.com/siderolabs/talos/pkg/version"
7+
import "github.com/siderolabs/talos/pkg/machinery/version"
88

99
type product struct {
1010
Vendor string `yaml:"vendor"`

0 commit comments

Comments
 (0)