diff --git a/api/services.go b/api/services.go index ac0df8369eb6..9640119d64bb 100644 --- a/api/services.go +++ b/api/services.go @@ -332,10 +332,6 @@ type ConsulGatewayBindAddress struct { Port int `mapstructure:"port"` } -const ( - defaultDNSDiscoveryType = "LOGICAL_DNS" -) - var ( defaultGatewayConnectTimeout = 5 * time.Second ) @@ -349,7 +345,6 @@ type ConsulGatewayProxy struct { EnvoyGatewayBindTaggedAddresses bool `mapstructure:"envoy_gateway_bind_tagged_addresses"` EnvoyGatewayBindAddresses map[string]*ConsulGatewayBindAddress `mapstructure:"envoy_gateway_bind_addresses"` EnvoyGatewayNoDefaultBind bool `mapstructure:"envoy_gateway_no_default_bind"` - EnvoyDNSDiscoveryType string `mapstructure:"envoy_dns_discovery_type"` Config map[string]interface{} // escape hatch envoy config } @@ -363,11 +358,6 @@ func (p *ConsulGatewayProxy) Canonicalize() { p.ConnectTimeout = timeToPtr(defaultGatewayConnectTimeout) } - if p.EnvoyDNSDiscoveryType == "" { - // same as default from consul - p.EnvoyDNSDiscoveryType = defaultDNSDiscoveryType - } - if len(p.EnvoyGatewayBindAddresses) == 0 { p.EnvoyGatewayBindAddresses = nil } @@ -403,7 +393,6 @@ func (p *ConsulGatewayProxy) Copy() *ConsulGatewayProxy { EnvoyGatewayBindTaggedAddresses: p.EnvoyGatewayBindTaggedAddresses, EnvoyGatewayBindAddresses: binds, EnvoyGatewayNoDefaultBind: p.EnvoyGatewayNoDefaultBind, - EnvoyDNSDiscoveryType: p.EnvoyDNSDiscoveryType, Config: config, } } diff --git a/api/services_test.go b/api/services_test.go index 0b06b2d864d1..2e5336855779 100644 --- a/api/services_test.go +++ b/api/services_test.go @@ -278,7 +278,6 @@ func TestService_ConsulGateway_Canonicalize(t *testing.T) { EnvoyGatewayBindTaggedAddresses: true, EnvoyGatewayBindAddresses: make(map[string]*ConsulGatewayBindAddress, 0), EnvoyGatewayNoDefaultBind: true, - EnvoyDNSDiscoveryType: "", Config: make(map[string]interface{}, 0), }, Ingress: &ConsulIngressConfigEntry{ @@ -290,7 +289,6 @@ func TestService_ConsulGateway_Canonicalize(t *testing.T) { } cg.Canonicalize() require.Equal(t, timeToPtr(5*time.Second), cg.Proxy.ConnectTimeout) - require.Equal(t, "LOGICAL_DNS", cg.Proxy.EnvoyDNSDiscoveryType) require.Nil(t, cg.Proxy.EnvoyGatewayBindAddresses) require.Nil(t, cg.Proxy.Config) require.Nil(t, cg.Ingress.Listeners) @@ -314,7 +312,6 @@ func TestService_ConsulGateway_Copy(t *testing.T) { "listener2": {Address: "10.0.0.1", Port: 2001}, }, EnvoyGatewayNoDefaultBind: true, - EnvoyDNSDiscoveryType: "BAD_TYPE", Config: map[string]interface{}{ "foo": "bar", "baz": 3, diff --git a/command/agent/consul/connect.go b/command/agent/consul/connect.go index b403df6cb5ab..c2cdc4ef1537 100644 --- a/command/agent/consul/connect.go +++ b/command/agent/consul/connect.go @@ -65,10 +65,6 @@ func newConnectGateway(serviceName string, connect *structs.ConsulConnect) *api. envoyConfig["connect_timeout_ms"] = proxy.ConnectTimeout.Milliseconds() } - if proxy.EnvoyDNSDiscoveryType != "" { - envoyConfig["envoy_dns_discovery_type"] = proxy.EnvoyDNSDiscoveryType - } - if len(proxy.Config) > 0 { for k, v := range proxy.Config { envoyConfig[k] = v diff --git a/command/agent/consul/connect_test.go b/command/agent/consul/connect_test.go index 2f7873098e4d..d5628b91e48a 100644 --- a/command/agent/consul/connect_test.go +++ b/command/agent/consul/connect_test.go @@ -416,15 +416,13 @@ func TestConnect_newConnectGateway(t *testing.T) { EnvoyGatewayBindTaggedAddresses: false, EnvoyGatewayBindAddresses: nil, EnvoyGatewayNoDefaultBind: false, - EnvoyDNSDiscoveryType: "LOGICAL_DNS", Config: nil, }, }, }) require.Equal(t, &api.AgentServiceConnectProxyConfig{ Config: map[string]interface{}{ - "connect_timeout_ms": int64(1000), - "envoy_dns_discovery_type": "LOGICAL_DNS", + "connect_timeout_ms": int64(1000), }, }, result) }) @@ -442,7 +440,6 @@ func TestConnect_newConnectGateway(t *testing.T) { }, }, EnvoyGatewayNoDefaultBind: true, - EnvoyDNSDiscoveryType: "STRICT_DNS", Config: map[string]interface{}{ "foo": 1, }, @@ -452,7 +449,6 @@ func TestConnect_newConnectGateway(t *testing.T) { require.Equal(t, &api.AgentServiceConnectProxyConfig{ Config: map[string]interface{}{ "connect_timeout_ms": int64(1000), - "envoy_dns_discovery_type": "STRICT_DNS", "envoy_gateway_bind_tagged_addresses": true, "envoy_gateway_bind_addresses": map[string]*structs.ConsulGatewayBindAddress{ "service1": &structs.ConsulGatewayBindAddress{ diff --git a/command/agent/job_endpoint.go b/command/agent/job_endpoint.go index 7896ee3b2ae4..422d2072d9c7 100644 --- a/command/agent/job_endpoint.go +++ b/command/agent/job_endpoint.go @@ -1326,7 +1326,6 @@ func apiConnectGatewayProxyToStructs(in *api.ConsulGatewayProxy) *structs.Consul EnvoyGatewayBindTaggedAddresses: in.EnvoyGatewayBindTaggedAddresses, EnvoyGatewayBindAddresses: bindAddresses, EnvoyGatewayNoDefaultBind: in.EnvoyGatewayNoDefaultBind, - EnvoyDNSDiscoveryType: in.EnvoyDNSDiscoveryType, Config: helper.CopyMapStringInterface(in.Config), } } diff --git a/command/agent/job_endpoint_test.go b/command/agent/job_endpoint_test.go index 9bc2f5ac6e4c..29bf1b31fe0e 100644 --- a/command/agent/job_endpoint_test.go +++ b/command/agent/job_endpoint_test.go @@ -3004,7 +3004,7 @@ func TestConversion_apiConnectSidecarServiceProxyToStructs(t *testing.T) { require.Equal(t, &structs.ConsulProxy{ LocalServiceAddress: "192.168.30.1", LocalServicePort: 9000, - Config: config, + Config: nil, Upstreams: []structs.ConsulUpstream{{ DestinationName: "upstream", }}, diff --git a/jobspec/parse_test.go b/jobspec/parse_test.go index 89255260371b..05af3a655b0f 100644 --- a/jobspec/parse_test.go +++ b/jobspec/parse_test.go @@ -1416,7 +1416,6 @@ func TestParse(t *testing.T) { "listener2": {Address: "10.0.0.2", Port: 8889}, }, EnvoyGatewayNoDefaultBind: true, - EnvoyDNSDiscoveryType: "LOGICAL_DNS", Config: map[string]interface{}{"foo": "bar"}, }, Ingress: &api.ConsulIngressConfigEntry{ diff --git a/jobspec/test-fixtures/tg-service-connect-gateway-ingress.hcl b/jobspec/test-fixtures/tg-service-connect-gateway-ingress.hcl index eac772fa79b1..453440df7039 100644 --- a/jobspec/test-fixtures/tg-service-connect-gateway-ingress.hcl +++ b/jobspec/test-fixtures/tg-service-connect-gateway-ingress.hcl @@ -17,7 +17,6 @@ job "connect_gateway_ingress" { port = 8889 } envoy_gateway_no_default_bind = true - envoy_dns_discovery_type = "LOGICAL_DNS" config { foo = "bar" } diff --git a/nomad/job_endpoint_hook_connect.go b/nomad/job_endpoint_hook_connect.go index a16e3cbc62a9..6b8b9269eeb0 100644 --- a/nomad/job_endpoint_hook_connect.go +++ b/nomad/job_endpoint_hook_connect.go @@ -293,7 +293,6 @@ func gatewayProxyForBridge(gateway *structs.ConsulGateway) *structs.ConsulGatewa proxy := new(structs.ConsulGatewayProxy) if gateway.Proxy != nil { proxy.ConnectTimeout = gateway.Proxy.ConnectTimeout - proxy.EnvoyDNSDiscoveryType = gateway.Proxy.EnvoyDNSDiscoveryType proxy.Config = gateway.Proxy.Config } diff --git a/nomad/job_endpoint_hook_connect_test.go b/nomad/job_endpoint_hook_connect_test.go index 1a4d1ba48a74..b348213845b9 100644 --- a/nomad/job_endpoint_hook_connect_test.go +++ b/nomad/job_endpoint_hook_connect_test.go @@ -300,9 +300,8 @@ func TestJobEndpointConnect_gatewayProxyIsDefault(t *testing.T) { t.Run("unrelated fields set", func(t *testing.T) { result := gatewayProxyIsDefault(&structs.ConsulGatewayProxy{ - ConnectTimeout: helper.TimeToPtr(2 * time.Second), - EnvoyDNSDiscoveryType: "STRICT_DNS", - Config: map[string]interface{}{"foo": 1}, + ConnectTimeout: helper.TimeToPtr(2 * time.Second), + Config: map[string]interface{}{"foo": 1}, }) require.True(t, result) }) @@ -430,9 +429,8 @@ func TestJobEndpointConnect_gatewayProxyForBridge(t *testing.T) { t.Run("fill in defaults", func(t *testing.T) { result := gatewayProxyForBridge(&structs.ConsulGateway{ Proxy: &structs.ConsulGatewayProxy{ - ConnectTimeout: helper.TimeToPtr(2 * time.Second), - EnvoyDNSDiscoveryType: "STRICT_DNS", - Config: map[string]interface{}{"foo": 1}, + ConnectTimeout: helper.TimeToPtr(2 * time.Second), + Config: map[string]interface{}{"foo": 1}, }, Ingress: &structs.ConsulIngressConfigEntry{ Listeners: []*structs.ConsulIngressListener{{ @@ -446,7 +444,6 @@ func TestJobEndpointConnect_gatewayProxyForBridge(t *testing.T) { }) require.Equal(t, &structs.ConsulGatewayProxy{ ConnectTimeout: helper.TimeToPtr(2 * time.Second), - EnvoyDNSDiscoveryType: "STRICT_DNS", Config: map[string]interface{}{"foo": 1}, EnvoyGatewayNoDefaultBind: true, EnvoyGatewayBindTaggedAddresses: false, diff --git a/nomad/job_endpoint_test.go b/nomad/job_endpoint_test.go index 23ae716d3e43..970a35b38992 100644 --- a/nomad/job_endpoint_test.go +++ b/nomad/job_endpoint_test.go @@ -341,7 +341,6 @@ func TestJobEndpoint_Register_ConnectIngressGateway_full(t *testing.T) { }, }, EnvoyGatewayNoDefaultBind: true, - EnvoyDNSDiscoveryType: "STRICT_DNS", Config: map[string]interface{}{ "foo": 1, "bar": "baz", diff --git a/nomad/structs/diff_test.go b/nomad/structs/diff_test.go index 5e0c13a5c3db..7ab44f0e059f 100644 --- a/nomad/structs/diff_test.go +++ b/nomad/structs/diff_test.go @@ -2629,7 +2629,6 @@ func TestTaskGroupDiff(t *testing.T) { }, }, EnvoyGatewayNoDefaultBind: false, - EnvoyDNSDiscoveryType: "LOGICAL_DNS", Config: map[string]interface{}{ "foo": 1, }, @@ -2704,7 +2703,6 @@ func TestTaskGroupDiff(t *testing.T) { }, }, EnvoyGatewayNoDefaultBind: true, - EnvoyDNSDiscoveryType: "STRICT_DNS", Config: map[string]interface{}{ "foo": 2, }, @@ -3024,12 +3022,6 @@ func TestTaskGroupDiff(t *testing.T) { Old: "1s", New: "2s", }, - { - Type: DiffTypeEdited, - Name: "EnvoyDNSDiscoveryType", - Old: "LOGICAL_DNS", - New: "STRICT_DNS", - }, { Type: DiffTypeEdited, Name: "EnvoyGatewayBindTaggedAddresses", diff --git a/nomad/structs/services.go b/nomad/structs/services.go index 5ffa78e67159..ae21053a9c7a 100644 --- a/nomad/structs/services.go +++ b/nomad/structs/services.go @@ -1282,7 +1282,6 @@ type ConsulGatewayProxy struct { EnvoyGatewayBindTaggedAddresses bool EnvoyGatewayBindAddresses map[string]*ConsulGatewayBindAddress EnvoyGatewayNoDefaultBind bool - EnvoyDNSDiscoveryType string Config map[string]interface{} } @@ -1301,7 +1300,6 @@ func (p *ConsulGatewayProxy) Copy() *ConsulGatewayProxy { EnvoyGatewayBindTaggedAddresses: p.EnvoyGatewayBindTaggedAddresses, EnvoyGatewayBindAddresses: bindAddresses, EnvoyGatewayNoDefaultBind: p.EnvoyGatewayNoDefaultBind, - EnvoyDNSDiscoveryType: p.EnvoyDNSDiscoveryType, Config: helper.CopyMapStringInterface(p.Config), } } @@ -1341,10 +1339,6 @@ func (p *ConsulGatewayProxy) Equals(o *ConsulGatewayProxy) bool { return false } - if p.EnvoyDNSDiscoveryType != o.EnvoyDNSDiscoveryType { - return false - } - if !opaqueMapsEqual(p.Config, o.Config) { return false } @@ -1361,11 +1355,6 @@ func (p *ConsulGatewayProxy) Validate() error { return fmt.Errorf("Consul Gateway Proxy connection_timeout must be set") } - dnsTypes := []string{"STRICT_DNS", "LOGICAL_DNS"} - if !helper.SliceStringContains(dnsTypes, p.EnvoyDNSDiscoveryType) { - return fmt.Errorf("Consul Gateway Proxy does not support DNS discovery type %q", p.EnvoyDNSDiscoveryType) - } - for _, bindAddr := range p.EnvoyGatewayBindAddresses { if err := bindAddr.Validate(); err != nil { return err diff --git a/nomad/structs/services_test.go b/nomad/structs/services_test.go index a465c76f414f..45b29b54fa9a 100644 --- a/nomad/structs/services_test.go +++ b/nomad/structs/services_test.go @@ -485,7 +485,6 @@ var ( "listener2": &ConsulGatewayBindAddress{Address: "10.0.0.1", Port: 2002}, }, EnvoyGatewayNoDefaultBind: true, - EnvoyDNSDiscoveryType: "STRICT_DNS", Config: map[string]interface{}{ "foo": 1, }, @@ -582,10 +581,6 @@ func TestConsulGateway_Equals_ingress(t *testing.T) { try(t, func(g *gway) { g.Proxy.EnvoyGatewayNoDefaultBind = false }) }) - t.Run("mod gateway envoy_dns_discovery_type", func(t *testing.T) { - try(t, func(g *gway) { g.Proxy.EnvoyDNSDiscoveryType = "LOGICAL_DNS" }) - }) - t.Run("mod gateway config", func(t *testing.T) { try(t, func(g *gway) { g.Proxy.Config = map[string]interface{}{ @@ -733,16 +728,14 @@ func TestConsulGatewayBindAddress_Validate(t *testing.T) { func TestConsulGatewayProxy_Validate(t *testing.T) { t.Run("no timeout", func(t *testing.T) { err := (&ConsulGatewayProxy{ - ConnectTimeout: nil, - EnvoyDNSDiscoveryType: "LOGICAL_DNS", + ConnectTimeout: nil, }).Validate() require.EqualError(t, err, "Consul Gateway Proxy connection_timeout must be set") }) t.Run("invalid bind address", func(t *testing.T) { err := (&ConsulGatewayProxy{ - ConnectTimeout: helper.TimeToPtr(1 * time.Second), - EnvoyDNSDiscoveryType: "LOGICAL_DNS", + ConnectTimeout: helper.TimeToPtr(1 * time.Second), EnvoyGatewayBindAddresses: map[string]*ConsulGatewayBindAddress{ "service1": { Address: "10.0.0.1", @@ -752,18 +745,9 @@ func TestConsulGatewayProxy_Validate(t *testing.T) { require.EqualError(t, err, "Consul Gateway Bind Address must set valid Port") }) - t.Run("invalid dns discovery type", func(t *testing.T) { - err := (&ConsulGatewayProxy{ - ConnectTimeout: helper.TimeToPtr(1 * time.Second), - EnvoyDNSDiscoveryType: "INVALID_DNS", - }).Validate() - require.EqualError(t, err, `Consul Gateway Proxy does not support DNS discovery type "INVALID_DNS"`) - }) - t.Run("ok with nothing set", func(t *testing.T) { err := (&ConsulGatewayProxy{ - ConnectTimeout: helper.TimeToPtr(1 * time.Second), - EnvoyDNSDiscoveryType: "LOGICAL_DNS", + ConnectTimeout: helper.TimeToPtr(1 * time.Second), }).Validate() require.NoError(t, err) }) @@ -778,7 +762,6 @@ func TestConsulGatewayProxy_Validate(t *testing.T) { }}, EnvoyGatewayBindTaggedAddresses: true, EnvoyGatewayNoDefaultBind: true, - EnvoyDNSDiscoveryType: "STRICT_DNS", }).Validate() require.NoError(t, err) }) diff --git a/vendor/github.com/hashicorp/nomad/api/services.go b/vendor/github.com/hashicorp/nomad/api/services.go index ac0df8369eb6..9640119d64bb 100644 --- a/vendor/github.com/hashicorp/nomad/api/services.go +++ b/vendor/github.com/hashicorp/nomad/api/services.go @@ -332,10 +332,6 @@ type ConsulGatewayBindAddress struct { Port int `mapstructure:"port"` } -const ( - defaultDNSDiscoveryType = "LOGICAL_DNS" -) - var ( defaultGatewayConnectTimeout = 5 * time.Second ) @@ -349,7 +345,6 @@ type ConsulGatewayProxy struct { EnvoyGatewayBindTaggedAddresses bool `mapstructure:"envoy_gateway_bind_tagged_addresses"` EnvoyGatewayBindAddresses map[string]*ConsulGatewayBindAddress `mapstructure:"envoy_gateway_bind_addresses"` EnvoyGatewayNoDefaultBind bool `mapstructure:"envoy_gateway_no_default_bind"` - EnvoyDNSDiscoveryType string `mapstructure:"envoy_dns_discovery_type"` Config map[string]interface{} // escape hatch envoy config } @@ -363,11 +358,6 @@ func (p *ConsulGatewayProxy) Canonicalize() { p.ConnectTimeout = timeToPtr(defaultGatewayConnectTimeout) } - if p.EnvoyDNSDiscoveryType == "" { - // same as default from consul - p.EnvoyDNSDiscoveryType = defaultDNSDiscoveryType - } - if len(p.EnvoyGatewayBindAddresses) == 0 { p.EnvoyGatewayBindAddresses = nil } @@ -403,7 +393,6 @@ func (p *ConsulGatewayProxy) Copy() *ConsulGatewayProxy { EnvoyGatewayBindTaggedAddresses: p.EnvoyGatewayBindTaggedAddresses, EnvoyGatewayBindAddresses: binds, EnvoyGatewayNoDefaultBind: p.EnvoyGatewayNoDefaultBind, - EnvoyDNSDiscoveryType: p.EnvoyDNSDiscoveryType, Config: config, } }