Skip to content

Commit

Permalink
Use etcd 3.4 client
Browse files Browse the repository at this point in the history
3.5 seems to have regressed on kubernetes/kubernetes#72102
  • Loading branch information
justinsb committed Feb 4, 2023
1 parent ef900fe commit bd3682d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 78 deletions.
25 changes: 13 additions & 12 deletions etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"time"

clientv3 "go.etcd.io/etcd/clientv3"
snapshot "go.etcd.io/etcd/clientv3/snapshot"
"go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes"
etcdpb "go.etcd.io/etcd/etcdserver/etcdserverpb"
"go.etcd.io/etcd/pkg/transport"
Expand Down Expand Up @@ -98,19 +99,19 @@ func Started(member *Member) bool {
}

// RestoreSnapshot initializes the etcd data directory from a snapshot
// Deprecated: we should be using the correct library version for this.
func RestoreSnapshot(cfg *apis.EtcdAdmConfig) error {
return fmt.Errorf("sapshot not implemented")
// sp := snapshot.NewV3(nil)

// return sp.Restore(snapshot.RestoreConfig{
// SnapshotPath: cfg.Snapshot,
// Name: cfg.Name,
// OutputDataDir: cfg.DataDir,
// PeerURLs: cfg.InitialAdvertisePeerURLs.StringSlice(),
// InitialCluster: cfg.InitialCluster,
// InitialClusterToken: cfg.InitialClusterToken,
// SkipHashCheck: cfg.SkipHashCheck,
// })
sp := snapshot.NewV3(nil)

return sp.Restore(snapshot.RestoreConfig{
SnapshotPath: cfg.Snapshot,
Name: cfg.Name,
OutputDataDir: cfg.DataDir,
PeerURLs: cfg.InitialAdvertisePeerURLs.StringSlice(),
InitialCluster: cfg.InitialCluster,
InitialClusterToken: cfg.InitialClusterToken,
SkipHashCheck: cfg.SkipHashCheck,
})
}

// InitialClusterFromMembers derives an "initial cluster" string from a member list
Expand Down
19 changes: 5 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,38 @@ module sigs.k8s.io/etcdadm

go 1.18

// This is 3.4.14; see https://github.com/etcd-io/etcd/issues/11154 for the reason.
replace go.etcd.io/etcd => go.etcd.io/etcd v0.5.0-alpha.5.0.20201125193152-8a03d2e9614b // indirect

require (
github.com/ghodss/yaml v1.0.0
github.com/google/go-cmp v0.5.9
github.com/pkg/errors v0.9.1
github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.7.0
github.com/spf13/cobra v1.6.0
//go.etcd.io/etcd/api/v3 v3.4.0
//go.etcd.io/etcd/client/pkg/v3 v3.4.0
// go.etcd.io/etcd/client/v3 v3.4.0
//go.etcd.io/etcd/etcdutl/v3 v3.4.0
//go.etcd.io/etcd v3.4.0+incompatible
k8s.io/apimachinery v0.26.0
k8s.io/client-go v0.26.0
k8s.io/component-base v0.22.0-beta.0
k8s.io/klog/v2 v2.80.1
sigs.k8s.io/yaml v1.3.0
)

require go.etcd.io/etcd v0.5.0-alpha.5.0.20201125193152-8a03d2e9614b

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.9.5 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jonboulle/clockwork v0.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -50,12 +44,9 @@ require (
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/soheilhy/cmux v0.1.4 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
go.etcd.io/bbolt v1.3.3 // indirect
go.etcd.io/etcd v0.5.0-alpha.5.0.20201125193152-8a03d2e9614b // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.0 // indirect
Expand Down
Loading

0 comments on commit bd3682d

Please sign in to comment.