-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
etcdmain: support SRV discovery for gRPC proxy #7676
Conversation
etcdmain/util.go
Outdated
) | ||
|
||
func discoverEndpoints(dns string, ca string, insecure bool) (endpoints []string) { | ||
if dns != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to limit indent depth:
if dns == "" {
return nil
}
etcdmain/util.go
Outdated
} | ||
plog.Infof("discovered the cluster %s from %s", endpoints, dns) | ||
// confirm TLS connections are good | ||
if !insecure { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can exit early here too:
if insecure {
return endpoints
}
All fixed. PTAL |
lgtm |
@fanminshi can you try this out manually? we can merge it when we know it works. |
@xiang90 will do. |
test results; succeeded. # Insecure
# dns records
example.com. IN SOA bindhostname. admin.example.com. (
1452607488
10800
3600
604800
38400 )
example.com. IN NS bindhostname.
infra0.example.com. 300 IN A 127.0.0.1
_etcd-client._tcp 300 IN SRV 0 0 2379 infra0.example.com.
_etcd-server._tcp 300 IN SRV 0 0 2380 infra0.example.com.
$ bin/etcd \
--name infra0 \
--data-dir /var/lib/etcd \
--discovery-srv example.com \
--listen-client-urls http://127.0.0.1:2379 \
--advertise-client-urls http://127.0.0.1:2379 \
--listen-peer-urls http://127.0.0.1:2380 \
--initial-advertise-peer-urls http://127.0.0.1:2380 \
--initial-cluster-token my-etcd-token \
--initial-cluster-state new \
--initial-cluster infra0=http://127.0.0.1:2380 \
$ bin/etcd grpc-proxy start --discovery-srv example.com --insecure-discovery
2017-04-06 18:01:45.425201 I | etcdmain: discovered the cluster [http://infra0.example.com.:2379] from example.com
2017-04-06 18:01:45.425289 I | etcdmain: listening for grpc-proxy client requests on 127.0.0.1:23790
2017-04-06 18:01:45.426274 E | etcdmain: forgot to set Type=notify in systemd service file?
# Secure
# dns record
example.com. IN SOA bindhostname. admin.example.com. (
1452607488
10800
3600
604800
38400 )
example.com. IN NS bindhostname.
infra0.example.com. 300 IN A 127.0.0.1
_etcd-client-ssl._tcp 300 IN SRV 0 0 2379 infra0.example.com.
_etcd-server-ssl._tcp 300 IN SRV 0 0 2380 infra0.example.com.
$ bin/etcd --name infra0 \
--data-dir /var/lib/etcd \
--discovery-srv example.com \
--listen-client-urls https://127.0.0.1:2379 \
--advertise-client-urls https://127.0.0.1:2379 \
--listen-peer-urls https://127.0.0.1:2380 \
--initial-advertise-peer-urls https://127.0.0.1:2380 \
--initial-cluster-token my-etcd-token \
--initial-cluster-state new \
--auto-compaction-retention 1 \
--client-cert-auth \
--trusted-ca-file /etc/ssl/certs/etcd-root-ca.pem \
--cert-file /etc/ssl/certs/infra0.pem \
--key-file /etc/ssl/certs/infra0-key.pem \
--peer-client-cert-auth \
--peer-trusted-ca-file /etc/ssl/certs/etcd-root-ca.pem \
--peer-cert-file /etc/ssl/certs/infra0.pem \
--peer-key-file /etc/ssl/certs/infra0-key.pem
bin/etcd grpc-proxy start --discovery-srv example.com \
--cacert /etc/ssl/certs/etcd-root-ca.pem \
--cert /etc/ssl/certs/infra0.pem \
--key /etc/ssl/certs/infra0-key.pem \
2017-04-06 19:12:26.156269 I | etcdmain: discovered the cluster [https://infra0.example.com.:2379] from example.com
2017-04-06 19:12:26.156317 I | etcdmain: validating discovered endpoints [https://infra0.example.com.:2379]
2017-04-06 19:12:26.156991 I | etcdmain: using discovered endpoints [https://infra0.example.com.:2379]
2017-04-06 19:12:26.157057 I | etcdmain: listening for grpc-proxy client requests on 127.0.0.1:23790
2017-04-06 19:12:26.199309 E | etcdmain: forgot to set Type=notify in systemd service file? |
lgtm |
Unrelated proxy-ci failure via #7346 |
FIX #7562