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

consul/connect: always set gateway proxy default timeout #9851

Merged
merged 1 commit into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

BUG FIXES:

* consul/connect: Fixed a bug where gateway proxy connection default timeout not set [[GH-9851](https://github.com/hashicorp/nomad/pull/9851)]
* scheduler: Fixed a bug where shared ports were not persisted during inplace updates for service jobs. [[GH-9830](https://github.com/hashicorp/nomad/issues/9830)]

## 1.0.2 (January 14, 2020)
Expand Down
2 changes: 2 additions & 0 deletions api/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ type ConsulGatewayBindAddress struct {
}

var (
// defaultConnectTimeout is the default amount of time a connect gateway will
// wait for a response from an upstream service (same as consul)
defaultGatewayConnectTimeout = 5 * time.Second
)

Expand Down
11 changes: 11 additions & 0 deletions nomad/job_endpoint_hook_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import (
"github.com/pkg/errors"
)

const (
// defaultConnectTimeout is the default amount of time a connect gateway will
// wait for a response from an upstream service (same as consul)
defaultConnectTimeout = 5 * time.Second
)

var (
// connectSidecarResources returns the set of resources used by default for
// the Consul Connect sidecar task
Expand Down Expand Up @@ -324,6 +330,11 @@ func gatewayProxyForBridge(gateway *structs.ConsulGateway) *structs.ConsulGatewa
proxy.Config = gateway.Proxy.Config
}

// set default connect timeout if not set
if proxy.ConnectTimeout == nil {
proxy.ConnectTimeout = helper.TimeToPtr(defaultConnectTimeout)
}

// magically set the fields where Nomad knows what to do
proxy.EnvoyGatewayNoDefaultBind = true
proxy.EnvoyGatewayBindTaggedAddresses = false
Expand Down
1 change: 1 addition & 0 deletions nomad/job_endpoint_hook_connect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ func TestJobEndpointConnect_gatewayProxyForBridge(t *testing.T) {
},
})
require.Equal(t, &structs.ConsulGatewayProxy{
ConnectTimeout: helper.TimeToPtr(defaultConnectTimeout),
EnvoyGatewayNoDefaultBind: true,
EnvoyGatewayBindTaggedAddresses: false,
EnvoyGatewayBindAddresses: map[string]*structs.ConsulGatewayBindAddress{
Expand Down
2 changes: 2 additions & 0 deletions vendor/github.com/hashicorp/nomad/api/services.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.