Skip to content

Commit

Permalink
Document fields and update MatchesConsul() test
Browse files Browse the repository at this point in the history
  • Loading branch information
analogue committed Nov 10, 2022
1 parent 438aae1 commit 77fb7c7
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ FEATURES:
* Support merged metrics with consul-dataplane. [[GH-1635](https://github.com/hashicorp/consul-k8s/pull/1635)]
* Support transparent proxying when using consul-dataplane. [[GH-1625](https://github.com/hashicorp/consul-k8s/pull/1478),[GH-1632](https://github.com/hashicorp/consul-k8s/pull/1632)]
* Enable sync-catalog to only talk to Consul servers. [[GH-1659](https://github.com/hashicorp/consul-k8s/pull/1659)]
* Ingress Gateway
* Add support for MaxConnections, MaxConcurrentRequests, and MaxPendingRequests to Ingress Gateway CRD. [[GH-1691](https://github.com/hashicorp/consul-k8s/pull/1691)]

IMPROVEMENTS:
* CLI
Expand Down
19 changes: 19 additions & 0 deletions charts/consul/templates/crd-ingressgateways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,21 @@ spec:
description: Defaults is default configuration for all upstream services
properties:
maxConcurrentRequests:
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.
format: int32
type: integer
maxConnections:
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.
format: int32
type: integer
maxPendingRequests:
description: The maximum number of requests that will be queued
while waiting for a connection to be established.
format: int32
type: integer
type: object
Expand Down Expand Up @@ -112,12 +121,22 @@ spec:
type: string
type: array
maxConcurrentRequests:
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.
format: int32
type: integer
maxConnections:
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.
format: int32
type: integer
maxPendingRequests:
description: The maximum number of requests that will
be queued while waiting for a connection to be established.
format: int32
type: integer
name:
Expand Down
24 changes: 20 additions & 4 deletions control-plane/api/v1alpha1/ingressgateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,16 @@ type IngressGatewaySpec struct {
}

type IngressServiceConfig struct {
MaxConnections *uint32 `json:"maxConnections,omitempty"`
MaxPendingRequests *uint32 `json:"maxPendingRequests,omitempty"`
// 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.
MaxConnections *uint32 `json:"maxConnections,omitempty"`
// The maximum number of requests that will be queued
// while waiting for a connection to be established.
MaxPendingRequests *uint32 `json:"maxPendingRequests,omitempty"`
// 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.
MaxConcurrentRequests *uint32 `json:"maxConcurrentRequests,omitempty"`
}

Expand Down Expand Up @@ -154,8 +162,16 @@ type IngressService struct {
RequestHeaders *HTTPHeaderModifiers `json:"requestHeaders,omitempty"`
ResponseHeaders *HTTPHeaderModifiers `json:"responseHeaders,omitempty"`

MaxConnections *uint32 `json:"maxConnections,omitempty"`
MaxPendingRequests *uint32 `json:"maxPendingRequests,omitempty"`
// 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.
MaxConnections *uint32 `json:"maxConnections,omitempty"`
// The maximum number of requests that will be queued
// while waiting for a connection to be established.
MaxPendingRequests *uint32 `json:"maxPendingRequests,omitempty"`
// 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.
MaxConcurrentRequests *uint32 `json:"maxConcurrentRequests,omitempty"`
}

Expand Down
41 changes: 33 additions & 8 deletions control-plane/api/v1alpha1/ingressgateway_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ import (
)

func TestIngressGateway_MatchesConsul(t *testing.T) {

defaultMaxConnections := uint32(100)
defaultMaxPendingRequests := uint32(101)
defaultMaxConcurrentRequests := uint32(102)

maxConnections := uint32(200)
maxPendingRequests := uint32(201)
maxConcurrentRequests := uint32(202)

cases := map[string]struct {
Ours IngressGateway
Theirs capi.ConfigEntry
Expand Down Expand Up @@ -54,6 +63,11 @@ func TestIngressGateway_MatchesConsul(t *testing.T) {
TLSMaxVersion: "TLSv1_1",
CipherSuites: []string{"ECDHE-ECDSA-AES128-GCM-SHA256", "AES128-SHA"},
},
Defaults: &IngressServiceConfig{
MaxConnections: &defaultMaxConnections,
MaxPendingRequests: &defaultMaxPendingRequests,
MaxConcurrentRequests: &defaultMaxConcurrentRequests,
},
Listeners: []IngressListener{
{
Port: 8888,
Expand All @@ -70,10 +84,13 @@ func TestIngressGateway_MatchesConsul(t *testing.T) {
},
Services: []IngressService{
{
Name: "name1",
Hosts: []string{"host1_1", "host1_2"},
Namespace: "ns1",
Partition: "default",
Name: "name1",
Hosts: []string{"host1_1", "host1_2"},
Namespace: "ns1",
Partition: "default",
MaxConnections: &maxConnections,
MaxPendingRequests: &maxPendingRequests,
MaxConcurrentRequests: &maxConcurrentRequests,
TLS: &GatewayServiceTLSConfig{
SDS: &GatewayTLSSDSConfig{
ClusterName: "cluster1",
Expand Down Expand Up @@ -144,6 +161,11 @@ func TestIngressGateway_MatchesConsul(t *testing.T) {
TLSMaxVersion: "TLSv1_1",
CipherSuites: []string{"ECDHE-ECDSA-AES128-GCM-SHA256", "AES128-SHA"},
},
Defaults: &capi.IngressServiceConfig{
MaxConnections: &defaultMaxConnections,
MaxPendingRequests: &defaultMaxPendingRequests,
MaxConcurrentRequests: &defaultMaxConcurrentRequests,
},
Listeners: []capi.IngressListener{
{
Port: 8888,
Expand All @@ -160,10 +182,13 @@ func TestIngressGateway_MatchesConsul(t *testing.T) {
},
Services: []capi.IngressService{
{
Name: "name1",
Hosts: []string{"host1_1", "host1_2"},
Namespace: "ns1",
Partition: "default",
Name: "name1",
Hosts: []string{"host1_1", "host1_2"},
Namespace: "ns1",
Partition: "default",
MaxConnections: &maxConnections,
MaxPendingRequests: &maxPendingRequests,
MaxConcurrentRequests: &maxConcurrentRequests,
TLS: &capi.GatewayServiceTLSConfig{
SDS: &capi.GatewayTLSSDSConfig{
ClusterName: "cluster1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,21 @@ spec:
description: Defaults is default configuration for all upstream services
properties:
maxConcurrentRequests:
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.
format: int32
type: integer
maxConnections:
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.
format: int32
type: integer
maxPendingRequests:
description: The maximum number of requests that will be queued
while waiting for a connection to be established.
format: int32
type: integer
type: object
Expand Down Expand Up @@ -105,12 +114,22 @@ spec:
type: string
type: array
maxConcurrentRequests:
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.
format: int32
type: integer
maxConnections:
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.
format: int32
type: integer
maxPendingRequests:
description: The maximum number of requests that will
be queued while waiting for a connection to be established.
format: int32
type: integer
name:
Expand Down

0 comments on commit 77fb7c7

Please sign in to comment.