Commit 8c73fd67 authored by Brad Davidson's avatar Brad Davidson Committed by Brad Davidson

Disable HTTP on main etcd client port

parent cae8b2b6
...@@ -37,6 +37,7 @@ type ETCDConfig struct { ...@@ -37,6 +37,7 @@ type ETCDConfig struct {
InitialOptions `json:",inline"` InitialOptions `json:",inline"`
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
ListenClientURLs string `json:"listen-client-urls,omitempty"` ListenClientURLs string `json:"listen-client-urls,omitempty"`
ListenClientHTTPURLs string `json:"listen-client-http-urls,omitempty"`
ListenMetricsURLs string `json:"listen-metrics-urls,omitempty"` ListenMetricsURLs string `json:"listen-metrics-urls,omitempty"`
ListenPeerURLs string `json:"listen-peer-urls,omitempty"` ListenPeerURLs string `json:"listen-peer-urls,omitempty"`
AdvertiseClientURLs string `json:"advertise-client-urls,omitempty"` AdvertiseClientURLs string `json:"advertise-client-urls,omitempty"`
......
...@@ -834,6 +834,14 @@ func (e *ETCD) listenMetricsURLs(reset bool) string { ...@@ -834,6 +834,14 @@ func (e *ETCD) listenMetricsURLs(reset bool) string {
return metricsURLs return metricsURLs
} }
// listenClientHTTPURLs returns a list of URLs to bind to for http client connections.
// This should no longer be used, but we must set it in order to free the listen URLs
// for dedicated use by GRPC.
// Ref: https://github.com/etcd-io/etcd/issues/15402
func (e *ETCD) listenClientHTTPURLs() string {
return fmt.Sprintf("https://%s:2382", e.config.Loopback(true))
}
// cluster calls the executor to start etcd running with the provided configuration. // cluster calls the executor to start etcd running with the provided configuration.
func (e *ETCD) cluster(ctx context.Context, reset bool, options executor.InitialOptions) error { func (e *ETCD) cluster(ctx context.Context, reset bool, options executor.InitialOptions) error {
ctx, e.cancel = context.WithCancel(ctx) ctx, e.cancel = context.WithCancel(ctx)
...@@ -864,6 +872,7 @@ func (e *ETCD) cluster(ctx context.Context, reset bool, options executor.Initial ...@@ -864,6 +872,7 @@ func (e *ETCD) cluster(ctx context.Context, reset bool, options executor.Initial
Logger: "zap", Logger: "zap",
LogOutputs: []string{"stderr"}, LogOutputs: []string{"stderr"},
ExperimentalInitialCorruptCheck: true, ExperimentalInitialCorruptCheck: true,
ListenClientHTTPURLs: e.listenClientHTTPURLs(),
}, e.config.ExtraEtcdArgs) }, e.config.ExtraEtcdArgs)
} }
...@@ -885,10 +894,16 @@ func (e *ETCD) StartEmbeddedTemporary(ctx context.Context) error { ...@@ -885,10 +894,16 @@ func (e *ETCD) StartEmbeddedTemporary(ctx context.Context) error {
endpoints := getEndpoints(e.config) endpoints := getEndpoints(e.config)
clientURL := endpoints[0] clientURL := endpoints[0]
// peer URL is usually 1 more than client
peerURL, err := addPort(endpoints[0], 1) peerURL, err := addPort(endpoints[0], 1)
if err != nil { if err != nil {
return err return err
} }
// client http URL is usually 3 more than client, after peer and metrics
clientHTTPURL, err := addPort(endpoints[0], 3)
if err != nil {
return err
}
embedded := executor.Embedded{} embedded := executor.Embedded{}
ctx, e.cancel = context.WithCancel(ctx) ctx, e.cancel = context.WithCancel(ctx)
...@@ -898,6 +913,7 @@ func (e *ETCD) StartEmbeddedTemporary(ctx context.Context) error { ...@@ -898,6 +913,7 @@ func (e *ETCD) StartEmbeddedTemporary(ctx context.Context) error {
ForceNewCluster: true, ForceNewCluster: true,
AdvertiseClientURLs: clientURL, AdvertiseClientURLs: clientURL,
ListenClientURLs: clientURL, ListenClientURLs: clientURL,
ListenClientHTTPURLs: clientHTTPURL,
ListenPeerURLs: peerURL, ListenPeerURLs: peerURL,
Logger: "zap", Logger: "zap",
HeartbeatInterval: 500, HeartbeatInterval: 500,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment