Skip to content

Commit 6d61c89

Browse files
authored
Mirror DestinationRule connection pool configuration on Sidecar (#2961)
* Add support for default and per-port connection pool settings for inbound connections to Envoy sidecars * flesh out comments on connection pool and describe how they relate to destinationrule. Add a release note for the new field. * missed comments in v1beta1 that should've been in v1alpha1
1 parent 2c49e44 commit 6d61c89

File tree

8 files changed

+1148
-174
lines changed

8 files changed

+1148
-174
lines changed

kubernetes/customresourcedefinitions.gen.yaml

Lines changed: 310 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

networking/v1alpha3/sidecar.pb.go

Lines changed: 255 additions & 113 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

networking/v1alpha3/sidecar.pb.html

Lines changed: 121 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

networking/v1alpha3/sidecar.proto

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
syntax = "proto3";
1616

1717
import "google/api/field_behavior.proto";
18+
import "networking/v1alpha3/destination_rule.proto";
1819
import "networking/v1alpha3/gateway.proto";
1920
import "networking/v1alpha3/virtual_service.proto";
2021

@@ -479,6 +480,82 @@ import "networking/v1alpha3/virtual_service.proto";
479480
// ```
480481
// {{</tab>}}
481482
// {{</tabset>}}
483+
//
484+
// In addition to configuring traffic capture and how traffic is forwarded to the app,
485+
// it's possible to control inbound connection pool settings. By default, Istio pushes
486+
// connection pool settings from `DestinationRules` to both clients (for outbound
487+
// connections to the service) as well as servers (for inbound connections to a service
488+
// instance). Using the `InboundConnectionPool` and per-port `ConnectionPool` settings
489+
// in a `Sidecar` allow you to control those connection pools for the server separately
490+
// from the settings pushed to all clients.
491+
//
492+
// {{<tabset category-name="example">}}
493+
// {{<tab name="v1alpha3" category-value="v1alpha3">}}
494+
// ```yaml
495+
// apiVersion: networking.istio.io/v1alpha3
496+
// kind: Sidecar
497+
// metadata:
498+
// name: connection-pool-settings
499+
// namespace: prod-us1
500+
// spec:
501+
// workloadSelector:
502+
// labels:
503+
// app: productpage
504+
// inboundConnectionPool:
505+
// http:
506+
// http1MaxPendingRequests: 1024
507+
// http2MaxRequests: 1024
508+
// maxRequestsPerConnection: 1024
509+
// maxRetries: 100
510+
// ingress:
511+
// - port:
512+
// number: 80
513+
// protocol: HTTP
514+
// name: somename
515+
// connectionPool:
516+
// http:
517+
// http1MaxPendingRequests: 1024
518+
// http2MaxRequests: 1024
519+
// maxRequestsPerConnection: 1024
520+
// maxRetries: 100
521+
// tcp:
522+
// maxConnections: 100
523+
// ```
524+
// {{</tab>}}
525+
//
526+
// {{<tab name="v1beta1" category-value="v1beta1">}}
527+
// ```yaml
528+
// apiVersion: networking.istio.io/v1beta1
529+
// kind: Sidecar
530+
// metadata:
531+
// name: connection-pool-settings
532+
// namespace: prod-us1
533+
// spec:
534+
// workloadSelector:
535+
// labels:
536+
// app: productpage
537+
// inboundConnectionPool:
538+
// http:
539+
// http1MaxPendingRequests: 1024
540+
// http2MaxRequests: 1024
541+
// maxRequestsPerConnection: 1024
542+
// maxRetries: 100
543+
// ingress:
544+
// - port:
545+
// number: 80
546+
// protocol: HTTP
547+
// name: somename
548+
// connectionPool:
549+
// http:
550+
// http1MaxPendingRequests: 1024
551+
// http2MaxRequests: 1024
552+
// maxRequestsPerConnection: 1024
553+
// maxRetries: 100
554+
// tcp:
555+
// maxConnections: 100
556+
// ```
557+
// {{</tab>}}
558+
// {{</tabset>}}
482559
package istio.networking.v1alpha3;
483560

484561
option go_package = "istio.io/api/networking/v1alpha3";
@@ -528,6 +605,32 @@ message Sidecar {
528605
// detected defaults from the namespace-wide or the global default Sidecar.
529606
repeated IstioEgressListener egress = 3;
530607

608+
// Settings controlling the volume of connections Envoy will accept from the network.
609+
// This default will apply for all inbound listeners and can be overridden per-port
610+
// in the `Ingress` field. This configuration mirrors the `DestinationRule`'s
611+
// [`connectionPool`](https://istio.io/latest/docs/reference/config/networking/destination-rule/#ConnectionPoolSettings) field.
612+
//
613+
// By default, Istio applies a service's `DestinationRule` to client sidecars
614+
// for outbound traffic directed at the service -- the usual case folks think
615+
// of when configuring a `DestinationRule` -- but also to the server's inbound
616+
// sidecar. The `Sidecar`'s connection pool configures the server's inbound
617+
// sidecar directly, so its settings can be different than clients'. This is
618+
// valuable, for example, when you have many clients calling few servers: a
619+
// `DestinationRule` can limit the concurrency of any single client, while
620+
// the `Sidecar` allows you to configure much higher concurrency on the server
621+
// side.
622+
//
623+
// Connection pool settings for a server's inbound sidecar are configured in the
624+
// following precedence, highest to lowest:
625+
// - per-port `ConnectionPool` from the `Sidecar`
626+
// - top level `InboundConnectionPool` from the `Sidecar`
627+
// - per-port `TrafficPolicy.ConnectionPool` from the `DestinationRule`
628+
// - top level `TrafficPolicy.ConnectionPool` from the `DestinationRule`
629+
// - default connection pool settings (essentially unlimited)
630+
//
631+
// In every case, the connection pool settings are overriden, not merged.
632+
ConnectionPoolSettings inbound_connection_pool = 7;
633+
531634
// Configuration for the outbound traffic policy. If your
532635
// application uses one or more external services that are not known
533636
// apriori, setting the policy to `ALLOW_ANY` will cause the
@@ -576,6 +679,15 @@ message IstioIngressListener {
576679
// sidecar for requests originating from outside the mesh.
577680
// Currently supports only SIMPLE and MUTUAL TLS modes.
578681
ServerTLSSettings tls = 7;
682+
683+
// Settings controlling the volume of connections Envoy will accept from the network.
684+
// This setting overrides the top-level default `inboundConnectionPool` to configure
685+
// specific settings for this port. This configuration mirrors the `DestinationRule`'s
686+
// [`PortTrafficPolicy.connectionPool`](https://istio.io/latest/docs/reference/config/networking/destination-rule/#TrafficPolicy-PortTrafficPolicy) field.
687+
// This port level connection pool has the highest precedence in configuration,
688+
// overriding both the `Sidecar`'s top level `InboundConnectionPool` as well as any
689+
// connection pooling settings from the `DestinationRule`.
690+
ConnectionPoolSettings connection_pool = 8;
579691
}
580692

581693
// `IstioEgressListener` specifies the properties of an outbound traffic

0 commit comments

Comments
 (0)