Skip to content

Commit

Permalink
fix: provide logger to the etcd snapshot restore
Browse files Browse the repository at this point in the history
With update of the client library to 3.5.3, etcd library started using
the logger, so using `nil` isn't fine anymore.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Apr 19, 2022
1 parent f190403 commit 68dfdd3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/talosctl/cmd/talos/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/spf13/cobra"
snapshot "go.etcd.io/etcd/etcdutl/v3/snapshot"

"github.com/talos-systems/talos/pkg/logging"
machineapi "github.com/talos-systems/talos/pkg/machinery/api/machine"
"github.com/talos-systems/talos/pkg/machinery/client"
)
Expand All @@ -37,7 +38,7 @@ Talos etcd cluster can be recovered from a known snapshot with '--recover-from='
RunE: func(cmd *cobra.Command, args []string) error {
return WithClient(func(ctx context.Context, c *client.Client) error {
if bootstrapCmdFlags.recoverFrom != "" {
manager := snapshot.NewV3(nil)
manager := snapshot.NewV3(logging.Wrap(os.Stderr))

status, err := manager.Status(bootstrapCmdFlags.recoverFrom)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmd/talosctl/cmd/talos/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/talos-systems/talos/cmd/talosctl/pkg/talos/helpers"
"github.com/talos-systems/talos/pkg/cli"
"github.com/talos-systems/talos/pkg/logging"
"github.com/talos-systems/talos/pkg/machinery/api/machine"
"github.com/talos-systems/talos/pkg/machinery/client"
)
Expand Down Expand Up @@ -192,7 +193,7 @@ var etcdSnapshotCmd = &cobra.Command{

fmt.Printf("etcd snapshot saved to %q (%d bytes)\n", dbPath, size)

manager := snapshot.NewV3(nil)
manager := snapshot.NewV3(logging.Wrap(os.Stderr))

status, err := manager.Status(dbPath)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion internal/app/machined/pkg/system/services/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"github.com/talos-systems/talos/internal/pkg/etcd"
"github.com/talos-systems/talos/pkg/argsbuilder"
"github.com/talos-systems/talos/pkg/conditions"
"github.com/talos-systems/talos/pkg/logging"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/machinery/constants"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
Expand Down Expand Up @@ -650,7 +651,7 @@ func (e *Etcd) argsForControlPlane(ctx context.Context, r runtime.Runtime) error

// recoverFromSnapshot recovers etcd data directory from the snapshot uploaded previously.
func (e *Etcd) recoverFromSnapshot(hostname, primaryAddr string) error {
manager := snapshot.NewV3(nil)
manager := snapshot.NewV3(logging.Wrap(log.Writer()))

status, err := manager.Status(constants.EtcdRecoverySnapshotPath)
if err != nil {
Expand Down

0 comments on commit 68dfdd3

Please sign in to comment.