Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to use etcd client v3 for CoreDNS provider #686

Merged
merged 2 commits into from
Nov 14, 2018

Conversation

shashidharatd
Copy link

@shashidharatd shashidharatd commented Aug 22, 2018

This PR is for migrating CoreDNS provider which is based on etcd client v2 to etcd client v3. (Fixes #659 )
Also fixed couple of below issue:

/cc @njuettner @linki @ideahitme

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 22, 2018
@@ -52,8 +52,8 @@ func NewLabels() Labels {
// NewLabelsFromString constructs endpoints labels from a provided format string
// if heritage set to another value is found then error is returned
// no heritage automatically assumes is not owned by external-dns and returns invalidHeritage error
func NewLabelsFromString(labelText string) (Labels, error) {
endpointLabels := map[string]string{}
func NewLabelsFromString(existingLabels map[string]string, labelText string) (Labels, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have to pass in a map string? TBH I don't like this idea.

Copy link
Member

@njuettner njuettner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR 👍 ! I made a comment above.

njuettner
njuettner previously approved these changes Sep 5, 2018
@pigmej
Copy link

pigmej commented Sep 19, 2018

@njuettner @shashidharatd any updates?

@shashidharatd
Copy link
Author

I am planning to work on it in few days !!

@shashidharatd
Copy link
Author

I am stuck now. stable etcd release version is 3.3.9 and it has dependency on google.golang.org/grpc with version v1.7.5. external-dns also had indirect dependency on google.golang.org/grpc and it is already updated to version v1.14.0. Because of this incompatibility we cannot use the stable etcd version now.
we have 2 choice.

  • wait for new stable etcd version.
  • use unstable master branch commit.

@shashidharatd
Copy link
Author

Here is the exact issue, i am stuck with and not able to bump etcd

root@laptop:~/gopath/src/github.com/kubernetes-incubator/external-dns# make verify
go test -v -race github.com/kubernetes-incubator/external-dns github.com/kubernetes-incubator/external-dns/controller github.com/kubernetes-incubator/external-dns/endpoint github.com/kubernetes-incubator/external-dns/internal/testutils github.com/kubernetes-incubator/external-dns/pkg/apis/externaldns github.com/kubernetes-incubator/external-dns/pkg/apis/externaldns/validation github.com/kubernetes-incubator/external-dns/pkg/tlsutils github.com/kubernetes-incubator/external-dns/plan github.com/kubernetes-incubator/external-dns/provider github.com/kubernetes-incubator/external-dns/registry github.com/kubernetes-incubator/external-dns/source
# github.com/kubernetes-incubator/external-dns/vendor/go.etcd.io/etcd/clientv3/balancer/picker
vendor/go.etcd.io/etcd/clientv3/balancer/picker/err.go:25:20: cannot use errPicker literal (type *errPicker) as type Picker in return argument:
	*errPicker does not implement Picker (wrong type for Pick method)
		have Pick("context".Context, balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error)
		want Pick("github.com/kubernetes-incubator/external-dns/vendor/golang.org/x/net/context".Context, balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error)
vendor/go.etcd.io/etcd/clientv3/balancer/picker/roundrobin_balanced.go:38:3: cannot use rrBalanced literal (type *rrBalanced) as type Picker in return argument:
	*rrBalanced does not implement Picker (wrong type for Pick method)
		have Pick("context".Context, balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error)
		want Pick("github.com/kubernetes-incubator/external-dns/vendor/golang.org/x/net/context".Context, balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error)
FAIL	github.com/kubernetes-incubator/external-dns/controller [build failed]

grpc/grpc-go#711

@jremond
Copy link

jremond commented Oct 18, 2018

Hello, we are trying to test external-dns with coredns 1.2.X / etcdv3 backend, any idea of the next step ?

@jremond
Copy link

jremond commented Oct 26, 2018

@shashidharatd I have been able to build a working external-dns binary when merging this PR into the master branch and make it work with our coredns/etcdv3 cluster.

@shashidharatd
Copy link
Author

@shashidharatd I have been able to build a working external-dns binary when merging this PR into the master branch and make it work with our coredns/etcdv3 cluster.

That's awesome, what is the etcd version you used, @jremond ?

@jremond
Copy link

jremond commented Oct 26, 2018

@shashidharatd
etcd Version: 3.3.8
Git SHA: 33245c6b5
Go Version: go1.9.7
Go OS/Arch: linux/amd64

coredns 1.2.1

I merged your code after 5ff808f in master

@shashidharatd
Copy link
Author

I am still getting the same error, when i do make verify
google.golang.org/grpc version used by etcd v3.3.8 is v1.7.5 https://github.com/etcd-io/etcd/blob/v3.3.8/glide.yaml#L113

google.golang.org/grpc version used in this project is v1.14.0 https://github.com/kubernetes-incubator/external-dns/blob/master/Gopkg.lock#L852

google.golang.org/grpc version v1.7.5 and v1.14.0 are not compatible.

This issue will be resolved by grpc/grpc-go#711 in 5 days. Then etcd should pick this change in their development branch, and we can use it in this project. a long shot.

@shashidharatd
Copy link
Author

@jremond, i suggest you create a new pr with your changes. that would trigger all tests and not just the binary build. lets see how it goes.

@jremond jremond mentioned this pull request Oct 26, 2018
@jremond
Copy link

jremond commented Oct 26, 2018

See #761

@shashidharatd
Copy link
Author

@jremond, recent changes in this repo seemed to fix the issue in this pr. I rebased this pr on latest changes and then did dep ensure. Now make verify works. Thanks for your prodding.

@shashidharatd
Copy link
Author

shashidharatd commented Oct 26, 2018

@njuettner @linki, this pr is now unblocked. can you please check it again. @njuettner, i have removed the commit on which you have objection. That problem should have been fixed by #713. Thanks !

@shashidharatd
Copy link
Author

/assign @njuettner

var sx []*Service
bx := make(map[Service]bool)
for _, n := range r.Kvs {
serv := new(Service)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be better to name it sor svc. servsounds more like server to me 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

queue.PushBack(childNode)
}
continue
var sx []*Service
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe svcs?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

}
continue
var sx []*Service
bx := make(map[Service]bool)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For someone which reads the code it's hard to tell what it does, could you find a better name? or just comment what it does :)

Copy link
Author

@shashidharatd shashidharatd Oct 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added comments now. sorry for the issue in readability. i referred to the etcd plugin in coredns here and didn't do too much of my own modifications.

Copy link
Author

@shashidharatd shashidharatd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @njuettner, can you ptal once again. have addressed your comments.

@njuettner
Copy link
Member

/LGTM

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 14, 2018
@njuettner
Copy link
Member

/APPROVE

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: njuettner

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 14, 2018
@k8s-ci-robot k8s-ci-robot merged commit 5fea753 into kubernetes-sigs:master Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CoreDNS Provider: ETCD datastore version
5 participants