-
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
gateway: DNS SRV priority #7882
Conversation
Trying to decouple the v2 client from SRV code. Can't move into discovery/ since that creates a circular dependency. So, give up and move all the SRV code into a new package.
7cb7c89
to
efe70d4
Compare
proxy/tcpproxy/userspace.go
Outdated
w += int(r.srv.Weight) + 1 | ||
} | ||
} | ||
// randomly choose by weight |
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.
A server selection mechanism. The weight field specifies a
relative weight for entries with the same priority. Larger
weights SHOULD be given a proportionately higher probability of
being selected. The range of this number is 0-65535. This is a
16 bit unsigned integer in network byte order. Domain
administrators SHOULD use Weight 0 when there isn't any server
selection to do, to make the RR easier to read for humans (less
noisy). In the presence of records containing weights greater
than 0, records with weight 0 should have a very small chance of
being selected.
Can we follow this?
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.
OK
Is there a plan for normal endpoints (like http://127.0.0.1:2379[priority:10,weight:80]) ? |
@xiang90 no. That format was never discussed. Do any other systems do it that way? |
Not I know of. I am not proposing the format here. But, it is important that we can support weighed routing in SRV discovery and other mechanisms similarly. |
This is just for the gateway. Anything using the client would need a new balancer to do that; it is way too late into the 3.2.0 cycle to have that without releasing a broken balancer. |
etcdmain/gateway.go
Outdated
@@ -67,6 +68,7 @@ func newGatewayStartCommand() *cobra.Command { | |||
|
|||
cmd.Flags().StringVar(&gatewayListenAddr, "listen-addr", "127.0.0.1:23790", "listen address") | |||
cmd.Flags().StringVar(&gatewayDNSCluster, "discovery-srv", "", "DNS domain used to bootstrap initial cluster") | |||
cmd.Flags().StringVar(&gatewayEndpointPolicy, "endpoint-policy", "round-robin", "Policy for selecting next connection's endpoint (round-robin, srv-priority)") |
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.
if they choose to use dns srv, the priority policy should always be respected, right? i do not think we need this flag.
b47c5d4
to
10b092e
Compare
Adds DNS SRV weighting and priorities to gateway. Partially addresses etcd-io#4378
10b092e
to
c232814
Compare
lgtm |
Codecov Report
@@ Coverage Diff @@
## master #7882 +/- ##
=========================================
Coverage ? 75.78%
=========================================
Files ? 332
Lines ? 26278
Branches ? 0
=========================================
Hits ? 19914
Misses ? 4934
Partials ? 1430
Continue to review full report at Codecov.
|
Fixes #4378