Skip to content

Commit

Permalink
chore: update gen and COSI runtime
Browse files Browse the repository at this point in the history
No actual changes, adapting to use new APIs.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Sep 22, 2023
1 parent 29b201d commit a52d3cd
Show file tree
Hide file tree
Showing 156 changed files with 514 additions and 490 deletions.
4 changes: 2 additions & 2 deletions cmd/installer/cmd/imager/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"os"
"runtime"

"github.com/siderolabs/gen/slices"
"github.com/siderolabs/gen/xslices"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"

Expand Down Expand Up @@ -71,7 +71,7 @@ var rootCmd = &cobra.Command{
},
}

prof.Input.SystemExtensions = slices.Map(
prof.Input.SystemExtensions = xslices.Map(
cmdFlags.SystemExtensionImages,
func(imageRef string) profile.ContainerAsset {
return profile.ContainerAsset{
Expand Down
8 changes: 4 additions & 4 deletions cmd/talosctl/cmd/mgmt/cluster/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"text/tabwriter"

"github.com/dustin/go-humanize"
"github.com/siderolabs/gen/slices"
"github.com/siderolabs/gen/xslices"
"github.com/spf13/cobra"

"github.com/siderolabs/talos/pkg/cli"
Expand Down Expand Up @@ -55,11 +55,11 @@ func showCluster(cluster provision.Cluster) error {
fmt.Fprintf(w, "NAME\t%s\n", cluster.Info().ClusterName)
fmt.Fprintf(w, "NETWORK NAME\t%s\n", cluster.Info().Network.Name)

cidrs := slices.Map(cluster.Info().Network.CIDRs, netip.Prefix.String)
cidrs := xslices.Map(cluster.Info().Network.CIDRs, netip.Prefix.String)

fmt.Fprintf(w, "NETWORK CIDR\t%s\n", strings.Join(cidrs, ","))

gateways := slices.Map(cluster.Info().Network.GatewayAddrs, netip.Addr.String)
gateways := xslices.Map(cluster.Info().Network.GatewayAddrs, netip.Addr.String)

fmt.Fprintf(w, "NETWORK GATEWAY\t%s\n", strings.Join(gateways, ","))
fmt.Fprintf(w, "NETWORK MTU\t%d\n", cluster.Info().Network.MTU)
Expand Down Expand Up @@ -93,7 +93,7 @@ func showCluster(cluster provision.Cluster) error {
disk = humanize.Bytes(node.DiskSize)
}

ips := slices.Map(node.IPs, netip.Addr.String)
ips := xslices.Map(node.IPs, netip.Addr.String)

fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\n",
node.Name,
Expand Down
7 changes: 4 additions & 3 deletions cmd/talosctl/cmd/mgmt/gen/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (
"net/url"
"os"
"path/filepath"
"slices"
"strings"

"github.com/hashicorp/go-multierror"
"github.com/siderolabs/gen/slices"
"github.com/siderolabs/gen/xslices"
sideronet "github.com/siderolabs/net"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
Expand Down Expand Up @@ -277,7 +278,7 @@ func validateFlags() error {
var err error

for _, outputType := range genConfigCmdFlags.outputTypes {
if !slices.Contains(allOutputTypes, func(t string) bool {
if !slices.ContainsFunc(allOutputTypes, func(t string) bool {
return t == outputType
}) {
err = multierror.Append(err, fmt.Errorf("invalid output type: %q", outputType))
Expand All @@ -288,7 +289,7 @@ func validateFlags() error {
}

func writeConfigBundle(configBundle *bundle.Bundle, outputPaths configOutputPaths, commentsFlags encoder.CommentsFlags) error {
outputTypesSet := slices.ToSet(genConfigCmdFlags.outputTypes)
outputTypesSet := xslices.ToSet(genConfigCmdFlags.outputTypes)

if _, ok := outputTypesSet[controlPlaneOutputType]; ok {
data, err := configBundle.Serialize(commentsFlags, machine.TypeControlPlane)
Expand Down
4 changes: 2 additions & 2 deletions cmd/talosctl/cmd/mgmt/loadbalancer_launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package mgmt
import (
"fmt"

"github.com/siderolabs/gen/slices"
"github.com/siderolabs/gen/xslices"
"github.com/siderolabs/go-loadbalancer/loadbalancer"
"github.com/spf13/cobra"
"go.uber.org/zap"
Expand All @@ -33,7 +33,7 @@ var loadbalancerLaunchCmd = &cobra.Command{
lb := loadbalancer.TCP{Logger: makeLogger()}

for _, port := range loadbalancerLaunchCmdFlags.ports {
upstreams := slices.Map(loadbalancerLaunchCmdFlags.upstreams, func(upstream string) string {
upstreams := xslices.Map(loadbalancerLaunchCmdFlags.upstreams, func(upstream string) string {
return fmt.Sprintf("%s:%d", upstream, port)
})

Expand Down
6 changes: 3 additions & 3 deletions cmd/talosctl/cmd/talos/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"text/tabwriter"

"github.com/dustin/go-humanize"
"github.com/siderolabs/gen/slices"
"github.com/siderolabs/gen/xslices"
"github.com/spf13/cobra"
snapshot "go.etcd.io/etcd/etcdutl/v3/snapshot"
"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -98,7 +98,7 @@ var etcdAlarmListCmd = &cobra.Command{
cli.Warning("%s", err)
}

return displayAlarms(slices.Map(response.Messages, func(v *machine.EtcdAlarm) alarmMessage {
return displayAlarms(xslices.Map(response.Messages, func(v *machine.EtcdAlarm) alarmMessage {
return v
}))
})
Expand All @@ -120,7 +120,7 @@ var etcdAlarmDisarmCmd = &cobra.Command{
cli.Warning("%s", err)
}

return displayAlarms(slices.Map(response.Messages, func(v *machine.EtcdAlarmDisarm) alarmMessage {
return displayAlarms(xslices.Map(response.Messages, func(v *machine.EtcdAlarmDisarm) alarmMessage {
return v
}))
})
Expand Down
4 changes: 2 additions & 2 deletions cmd/talosctl/cmd/talos/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"text/tabwriter"
"time"

"github.com/siderolabs/gen/slices"
"github.com/siderolabs/gen/xslices"
"github.com/spf13/cobra"

"github.com/siderolabs/talos/cmd/talosctl/pkg/talos/helpers"
Expand Down Expand Up @@ -100,7 +100,7 @@ var eventsCmd = &cobra.Command{
msg.GetStage().String(),
fmt.Sprintf("ready: %v, unmet conditions: %v",
msg.GetStatus().Ready,
slices.Map(msg.GetStatus().GetUnmetConditions(),
xslices.Map(msg.GetStatus().GetUnmetConditions(),
func(c *machine.MachineStatusEvent_MachineStatus_UnmetCondition) string {
return c.Name
},
Expand Down
6 changes: 2 additions & 4 deletions cmd/talosctl/cmd/talos/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func completeResourceDefinition(withAliases bool) ([]string, cobra.ShellCompDire
return err
}

for iter := safe.IteratorFromList(items); iter.Next(); {
for iter := items.Iterator(); iter.Next(); {
if withAliases {
result = append(result, iter.Value().TypedSpec().Aliases...)
}
Expand Down Expand Up @@ -296,9 +296,7 @@ func CompleteNodes(*cobra.Command, []string, string) ([]string, cobra.ShellCompD
return err
}

it := safe.IteratorFromList(items)

for it.Next() {
for it := items.Iterator(); it.Next(); {
if hostname := it.Value().TypedSpec().Hostname; hostname != "" {
nodes = append(nodes, hostname)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/talosctl/cmd/talos/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sync"

criconstants "github.com/containerd/containerd/pkg/cri/constants"
"github.com/siderolabs/gen/slices"
"github.com/siderolabs/gen/xslices"
"github.com/spf13/cobra"
"google.golang.org/grpc/codes"

Expand Down Expand Up @@ -136,7 +136,7 @@ func (slicer *lineSlicer) chopper(r io.Reader, hostname string) {

for scanner.Scan() {
line := scanner.Bytes()
line = slices.Copy(line, len(line))
line = xslices.CopyN(line, len(line))

slicer.respCh <- &common.Data{
Metadata: &common.Metadata{
Expand Down
2 changes: 1 addition & 1 deletion cmd/talosctl/cmd/talos/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"context"
"fmt"
"io"
"slices"
"sort"
"strings"

criconstants "github.com/containerd/containerd/pkg/cri/constants"
"github.com/siderolabs/gen/maps"
"github.com/siderolabs/gen/slices"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand Down
4 changes: 2 additions & 2 deletions cmd/talosctl/cmd/talos/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"time"

"github.com/siderolabs/gen/maps"
"github.com/siderolabs/gen/slices"
"github.com/siderolabs/gen/xslices"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/peer"
Expand Down Expand Up @@ -152,7 +152,7 @@ func init() {
return machine.UpgradeRequest_RebootMode_value[rebootModes[i]] < machine.UpgradeRequest_RebootMode_value[rebootModes[j]]
})

rebootModes = slices.Map(rebootModes, strings.ToLower)
rebootModes = xslices.Map(rebootModes, strings.ToLower)

upgradeCmd.Flags().StringVarP(&upgradeCmdFlags.upgradeImage, "image", "i",
fmt.Sprintf("%s/%s/installer:%s", images.Registry, images.Username, version.Trim(version.Tag)),
Expand Down
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/siderolabs/talos

go 1.21
go 1.21.1

replace (
// Use nested module.
Expand Down Expand Up @@ -38,7 +38,7 @@ require (
github.com/containernetworking/cni v1.1.2
github.com/containernetworking/plugins v1.3.0
github.com/coreos/go-iptables v0.7.0
github.com/cosi-project/runtime v0.3.1
github.com/cosi-project/runtime v0.3.9
github.com/docker/distribution v2.8.2+incompatible
github.com/docker/docker v24.0.5+incompatible
github.com/docker/go-connections v0.4.0
Expand Down Expand Up @@ -94,7 +94,7 @@ require (
github.com/siderolabs/crypto v0.4.1
github.com/siderolabs/discovery-api v0.1.3
github.com/siderolabs/discovery-client v0.1.5
github.com/siderolabs/gen v0.4.5
github.com/siderolabs/gen v0.4.7
github.com/siderolabs/go-blockdevice v0.4.6
github.com/siderolabs/go-circular v0.1.0
github.com/siderolabs/go-cmd v0.1.1
Expand Down Expand Up @@ -127,16 +127,16 @@ require (
go.etcd.io/etcd/client/pkg/v3 v3.5.9
go.etcd.io/etcd/client/v3 v3.5.9
go.etcd.io/etcd/etcdutl/v3 v3.5.9
go.uber.org/zap v1.25.0
go.uber.org/zap v1.26.0
go4.org/netipx v0.0.0-20230728184502-ec4c8b891b28
golang.org/x/net v0.14.0
golang.org/x/net v0.15.0
golang.org/x/sync v0.3.0
golang.org/x/sys v0.11.0
golang.org/x/term v0.11.0
golang.org/x/text v0.12.0
golang.org/x/sys v0.12.0
golang.org/x/term v0.12.0
golang.org/x/text v0.13.0
golang.org/x/time v0.3.0
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6
google.golang.org/grpc v1.58.0
google.golang.org/grpc v1.58.1
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/klog/v2 v2.100.1
Expand All @@ -153,7 +153,7 @@ require (
github.com/Microsoft/hcsshim v0.9.9 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
github.com/ProtonMail/gopenpgp/v2 v2.7.2 // indirect
github.com/ProtonMail/gopenpgp/v2 v2.7.3 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 // indirect
github.com/aws/aws-sdk-go-v2 v1.21.0 // indirect
Expand Down Expand Up @@ -210,7 +210,7 @@ require (
github.com/gorilla/mux v1.8.0 // indirect
github.com/gosuri/uilive v0.0.4 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-envparse v0.1.0
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
Expand Down Expand Up @@ -292,15 +292,15 @@ require (
go.opentelemetry.io/otel/trace v1.10.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/tools v0.11.0 // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
Loading

0 comments on commit a52d3cd

Please sign in to comment.