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

feat(ingress gateway: support configuring limits in ingress-gateway c… #14749

Merged
merged 8 commits into from
Sep 28, 2022

Conversation

huikang
Copy link
Contributor

@huikang huikang commented Sep 26, 2022

Description

As a user of ingress gateway, I want to increase the max_connections of the service in the ingress-gateway config entry (link to the detailed description). However, in current implementation, max_coonections can’t be changed and is set to the default value of 1024 by envoy.

This PR adds a new field named Defaults to the ingress-gateway config entry and max_xyz to individual listening services. The new fields allow user to configure the max_xyz of the upstream cluster of a specified service behind the ingress gateway.

  • updated unit test and integration test
  • updated external-facing doc

Fixes #13374

Testing & Reproduction steps

  • A full example is verified in the integration test (test/integration/connect/envoy/case-ingress-gateway-multiple-services/config_entries.hcl).
Kind = "ingress-gateway"
Name = "my-ingress-gateway"

Defaults {
    MaxConnections = 2048          // <----- increase the max_connections of all upstream service instances
}
Listeners = [
 {
   Port = 8082
   Protocol = "http"
   Services = [
     {
        Name = "counting"
        Hosts = ["*"]
        MaxConnections = 5120          // <----- increase the max_connections, overwrite the value in Defaults
     },
     {
       Name = "counting-v2"
       Hosts = ["v2"]
     }
   ]
 }
]
  • envoy cluster
counting.default.dc2.internal.ca9229ae-1b1d-af9d-47fa-43885f09557a.consul::default_priority::max_connections::5120
counting.default.dc2.internal.ca9229ae-1b1d-af9d-47fa-43885f09557a.consul::default_priority::max_pending_requests::1024
counting.default.dc2.internal.ca9229ae-1b1d-af9d-47fa-43885f09557a.consul::default_priority::max_requests::1024
counting.default.dc2.internal.ca9229ae-1b1d-af9d-47fa-43885f09557a.consul::default_priority::max_retries::3

Links

Address #13374
Supersede #14708

Please be mindful not to leak any customer or confidential information. HashiCorp employees may want to use our internal URL shortener to obfuscate links.

PR Checklist

  • updated test coverage
  • external facing docs updated
  • not a security concern

@huikang huikang requested a review from a team as a code owner September 26, 2022 14:20
@github-actions github-actions bot added theme/api Relating to the HTTP API interface theme/envoy/xds Related to Envoy support type/docs Documentation needs to be created/updated/clarified labels Sep 26, 2022
Copy link
Contributor

@DanStough DanStough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some editorial comments we could discuss but overall looks great!

agent/structs/config_entry_gateways.go Show resolved Hide resolved
Comment on lines 1054 to 1075
{
name: 'MaxConnections',
type: 'int: 0',
description: `The maximum number of connections a service instance
will be allowed to establish against the given upstream. Use this to limit
HTTP/1.1 traffic, since HTTP/1.1 has a request per connection.`,
},
{
name: 'MaxPendingRequests',
type: 'int: 0',
description: `The maximum number of requests that will be queued
while waiting for a connection to be established. For this configuration to
be respected, a L7 protocol must be defined in the \`protocol\` field.`,
},
{
name: 'MaxConcurrentRequests',
type: 'int: 0',
description: `The maximum number of concurrent requests that
will be allowed at a single point in time. Use this to limit HTTP/2 traffic,
since HTTP/2 has many requests per connection. For this configuration to be
respected, a L7 protocol must be defined in the \`protocol\` field.`,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention the default values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in the following commit

{
name: 'MaxConnections',
type: 'int: 0',
description: overrides for `Defaults` configuration,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would provide a link to these configuration items.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in the following commit

api/config_entry_gateways.go Outdated Show resolved Hide resolved
Comment on lines 43 to 45
MaxConnections int32
MaxPendingRequests int32
MaxConcurrentRequests int32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uint32 would be more accurate per envoy, correct?

api/config_entry_gateways_test.go Outdated Show resolved Hide resolved
huikang and others added 5 commits September 27, 2022 14:46
…onfig entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
@huikang huikang force-pushed the gh-add-ingress-gateway-configentry-limits branch from 7a9962b to d896381 Compare September 27, 2022 19:17
Copy link
Contributor

@DanStough DanStough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🚀

@david-yu
Copy link
Contributor

@huikang This will also need a PR on consul-k8s to apply this new config via CRDs

huikang added a commit that referenced this pull request Sep 28, 2022
#14749)

* feat(ingress gateway: support configuring limits in ingress-gateway config entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
huikang added a commit that referenced this pull request Sep 28, 2022
#14749)

* feat(ingress gateway: support configuring limits in ingress-gateway config entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
huikang added a commit that referenced this pull request Sep 30, 2022
#14749)

* feat(ingress gateway: support configuring limits in ingress-gateway config entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
huikang added a commit that referenced this pull request Oct 3, 2022
#14749)

* feat(ingress gateway: support configuring limits in ingress-gateway config entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
huikang pushed a commit that referenced this pull request Oct 4, 2022
…ss-gateway c… into release/1.13.x (#14791)

* no-op commit due to failed cherry-picking

* feat(ingress gateway: support configuring limits in ingress-gateway c… (#14749)

* feat(ingress gateway: support configuring limits in ingress-gateway config entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
huikang pushed a commit that referenced this pull request Oct 14, 2022
#14749)

* feat(ingress gateway: support configuring limits in ingress-gateway config entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
huikang added a commit that referenced this pull request Oct 14, 2022
…ss-gateway c… into release/1.12.x (#14790)

* feat(ingress gateway: support configuring limits in ingress-gateway c… (#14749)

* feat(ingress gateway: support configuring limits in ingress-gateway config entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>

* fix flaky integration test (#14843)

* remove pbconfigentry

Co-authored-by: temp <temp@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
Co-authored-by: cskh <hui.kang@hashicorp.com>
huikang pushed a commit that referenced this pull request Oct 14, 2022
…ss-gateway c… into release/1.12.x (#14790)

* feat(ingress gateway: support configuring limits in ingress-gateway c… (#14749)

* feat(ingress gateway: support configuring limits in ingress-gateway config entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
huikang pushed a commit that referenced this pull request Oct 14, 2022
…ss-gateway c… into release/1.12.x (#14790)

* feat(ingress gateway: support configuring limits in ingress-gateway c… (#14749)

* feat(ingress gateway: support configuring limits in ingress-gateway config entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
huikang pushed a commit that referenced this pull request Oct 15, 2022
…ss-gateway c… into release/1.11.x (#14789)

* Backport of feat(ingress gateway: support configuring limits in ingress-gateway c… into release/1.12.x (#14790)

* feat(ingress gateway: support configuring limits in ingress-gateway c… (#14749)

* feat(ingress gateway: support configuring limits in ingress-gateway config entry

- a new Defaults field with max_connections, max_pending_connections, max_requests
  is added to ingress gateway config entry
- new field max_connections, max_pending_connections, max_requests in
  individual services to overwrite the value in Default
- added unit test and integration test
- updated doc

Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
Co-authored-by: Dan Stough <dan.stough@hashicorp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/api Relating to the HTTP API interface theme/envoy/xds Related to Envoy support type/docs Documentation needs to be created/updated/clarified
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable max connections for ingress-gateway
3 participants