Skip to content

Commit 489e529

Browse files
authored
add circuit breaker thresholds (#1171)
## Summary Add circuit breaker thersholds. ## Related issues - [ENG-2476](https://linear.app/pomerium/issue/ENG-2476/ingress-controller-add-circuit-breaker-settings) ## Checklist - [x] reference any related issues - [x] updated docs - [x] updated unit tests - [ ] updated UPGRADING.md - [x] add appropriate tag (`improvement` / `bug` / etc) - [x] ready for review
1 parent c1a2434 commit 489e529

9 files changed

Lines changed: 268 additions & 27 deletions

File tree

apis/ingress/v1/pomerium_types.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ type PomeriumSpec struct {
337337

338338
// DownstreamMTLS sets the <a href="https://www.pomerium.com/docs/reference/downstream-mtls-settings">Downstream MTLS Settings</a>.
339339
DownstreamMTLS *DownstreamMTLS `json:"downstreamMtls,omitempty"`
340+
341+
// CircuitBreakerThresholds sets the circuit breaker thresholds settings.
342+
CircuitBreakerThresholds *CircuitBreakerThresholds `json:"circuitBreakerThresholds,omitempty"`
340343
}
341344

342345
// OTEL configures OpenTelemetry.
@@ -410,6 +413,40 @@ type Timeouts struct {
410413
Idle *metav1.Duration `json:"idle,omitempty"`
411414
}
412415

416+
// CircuitBreakerThresholds are the circuit breaker thresholds.
417+
type CircuitBreakerThresholds struct {
418+
// MaxConnections sets the maximum number of connections that Envoy will
419+
// make to the upstream cluster. If not specified, the default is 1024.
420+
//
421+
// +kubebuilder:validation:Optional
422+
MaxConnections *uint32 `json:"maxConnections,omitempty"`
423+
// MaxPendingRequests sets the maximum number of pending requests that
424+
// Envoy will allow to the upstream cluster. If not specified, the
425+
// default is 1024. This limit is applied as a connection limit for
426+
// non-HTTP traffic.
427+
//
428+
// +kubebuilder:validation:Optional
429+
MaxPendingRequests *uint32 `json:"maxPendingRequests,omitempty"`
430+
// MaxRequests sets the maximum number of parallel requests that Envoy
431+
// will make to the upstream cluster. If not specified, the default is
432+
// 1024. This limit does not apply to non-HTTP traffic.
433+
//
434+
// +kubebuilder:validation:Optional
435+
MaxRequests *uint32 `json:"maxRequests,omitempty"`
436+
// MaxRetries sets the maximum number of parallel retries that Envoy
437+
// will allow to the upstream cluster. If not specified, the default is 3.
438+
//
439+
// +kubebuilder:validation:Optional
440+
MaxRetries *uint32 `json:"maxRetries,omitempty"`
441+
// MaxConnectionPools sets the maximum number of connection pools per
442+
// cluster that Envoy will concurrently support at once. If not specified,
443+
// the default is unlimited. Set this for clusters which create a large
444+
// number of connection pools.
445+
//
446+
// +kubebuilder:validation:Optional
447+
MaxConnectionPools *uint32 `json:"maxConnectionPools"`
448+
}
449+
413450
// ResourceStatus represents the outcome of the latest attempt to reconcile
414451
// relevant Kubernetes resource with Pomerium.
415452
type ResourceStatus struct {

apis/ingress/v1/zz_generated.deepcopy.go

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

config/crd/bases/ingress.pomerium.io_pomerium.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,46 @@ spec:
103103
items:
104104
type: string
105105
type: array
106+
circuitBreakerThresholds:
107+
description: CircuitBreakerThresholds sets the circuit breaker thresholds
108+
settings.
109+
properties:
110+
maxConnectionPools:
111+
description: |-
112+
MaxConnectionPools sets the maximum number of connection pools per
113+
cluster that Envoy will concurrently support at once. If not specified,
114+
the default is unlimited. Set this for clusters which create a large
115+
number of connection pools.
116+
format: int32
117+
type: integer
118+
maxConnections:
119+
description: |-
120+
MaxConnections sets the maximum number of connections that Envoy will
121+
make to the upstream cluster. If not specified, the default is 1024.
122+
format: int32
123+
type: integer
124+
maxPendingRequests:
125+
description: |-
126+
MaxPendingRequests sets the maximum number of pending requests that
127+
Envoy will allow to the upstream cluster. If not specified, the
128+
default is 1024. This limit is applied as a connection limit for
129+
non-HTTP traffic.
130+
format: int32
131+
type: integer
132+
maxRequests:
133+
description: |-
134+
MaxRequests sets the maximum number of parallel requests that Envoy
135+
will make to the upstream cluster. If not specified, the default is
136+
1024. This limit does not apply to non-HTTP traffic.
137+
format: int32
138+
type: integer
139+
maxRetries:
140+
description: |-
141+
MaxRetries sets the maximum number of parallel retries that Envoy
142+
will allow to the upstream cluster. If not specified, the default is 3.
143+
format: int32
144+
type: integer
145+
type: object
106146
codecType:
107147
description: CodecType sets the <a href="https://www.pomerium.com/docs/reference/codec-type">Codec
108148
Type</a>.

deployment.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,46 @@ spec:
245245
items:
246246
type: string
247247
type: array
248+
circuitBreakerThresholds:
249+
description: CircuitBreakerThresholds sets the circuit breaker thresholds
250+
settings.
251+
properties:
252+
maxConnectionPools:
253+
description: |-
254+
MaxConnectionPools sets the maximum number of connection pools per
255+
cluster that Envoy will concurrently support at once. If not specified,
256+
the default is unlimited. Set this for clusters which create a large
257+
number of connection pools.
258+
format: int32
259+
type: integer
260+
maxConnections:
261+
description: |-
262+
MaxConnections sets the maximum number of connections that Envoy will
263+
make to the upstream cluster. If not specified, the default is 1024.
264+
format: int32
265+
type: integer
266+
maxPendingRequests:
267+
description: |-
268+
MaxPendingRequests sets the maximum number of pending requests that
269+
Envoy will allow to the upstream cluster. If not specified, the
270+
default is 1024. This limit is applied as a connection limit for
271+
non-HTTP traffic.
272+
format: int32
273+
type: integer
274+
maxRequests:
275+
description: |-
276+
MaxRequests sets the maximum number of parallel requests that Envoy
277+
will make to the upstream cluster. If not specified, the default is
278+
1024. This limit does not apply to non-HTTP traffic.
279+
format: int32
280+
type: integer
281+
maxRetries:
282+
description: |-
283+
MaxRetries sets the maximum number of parallel retries that Envoy
284+
will allow to the upstream cluster. If not specified, the default is 3.
285+
format: int32
286+
type: integer
287+
type: object
248288
codecType:
249289
description: CodecType sets the <a href="https://www.pomerium.com/docs/reference/codec-type">Codec
250290
Type</a>.

go.mod

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ require (
1616
github.com/iancoleman/strcase v0.3.0
1717
github.com/martinlindhe/base36 v1.1.1
1818
github.com/open-policy-agent/opa v1.5.0
19-
github.com/pomerium/pomerium v0.28.1-0.20250509170134-93b8c93daa0f
19+
github.com/pomerium/csrf v1.7.0
20+
github.com/pomerium/pomerium v0.28.1-0.20250616153839-5ac7ae9c26be
2021
github.com/rs/zerolog v1.34.0
2122
github.com/sergi/go-diff v1.3.1
2223
github.com/spf13/cobra v1.9.1
@@ -52,6 +53,7 @@ require (
5253
cloud.google.com/go/storage v1.53.0 // indirect
5354
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
5455
github.com/CAFxX/httpcompression v0.0.9 // indirect
56+
github.com/DataDog/zstd v1.5.6-0.20230824185856-869dae002e5e // indirect
5557
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 // indirect
5658
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 // indirect
5759
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 // indirect
@@ -85,6 +87,14 @@ require (
8587
github.com/cespare/xxhash/v2 v2.3.0 // indirect
8688
github.com/cloudflare/circl v1.6.1 // indirect
8789
github.com/cncf/xds/go v0.0.0-20250121191232-2f005788dc42 // indirect
90+
github.com/cockroachdb/crlib v0.0.0-20241015224233-894974b3ad94 // indirect
91+
github.com/cockroachdb/errors v1.11.3 // indirect
92+
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
93+
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
94+
github.com/cockroachdb/pebble/v2 v2.0.4 // indirect
95+
github.com/cockroachdb/redact v1.1.5 // indirect
96+
github.com/cockroachdb/swiss v0.0.0-20250304010804-34a2c6a59016 // indirect
97+
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
8898
github.com/coreos/go-oidc/v3 v3.14.1 // indirect
8999
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
90100
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
@@ -96,6 +106,7 @@ require (
96106
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
97107
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
98108
github.com/gaissmai/bart v0.20.4 // indirect
109+
github.com/getsentry/sentry-go v0.27.0 // indirect
99110
github.com/go-chi/chi/v5 v5.2.1 // indirect
100111
github.com/go-ini/ini v1.67.0 // indirect
101112
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
@@ -113,7 +124,7 @@ require (
113124
github.com/gobwas/glob v0.2.3 // indirect
114125
github.com/gogo/protobuf v1.3.2 // indirect
115126
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
116-
github.com/golang/snappy v0.0.4 // indirect
127+
github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e // indirect
117128
github.com/google/btree v1.1.3 // indirect
118129
github.com/google/cel-go v0.25.0 // indirect
119130
github.com/google/gnostic-models v0.6.9 // indirect
@@ -138,6 +149,8 @@ require (
138149
github.com/jxskiss/base62 v1.1.0 // indirect
139150
github.com/klauspost/compress v1.18.0 // indirect
140151
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
152+
github.com/kr/pretty v0.3.1 // indirect
153+
github.com/kr/text v0.2.0 // indirect
141154
github.com/leodido/go-urn v1.4.0 // indirect
142155
github.com/libdns/libdns v1.0.0-beta.1 // indirect
143156
github.com/lufia/plan9stats v0.0.0-20240513124658-fba389f38bae // indirect
@@ -160,18 +173,18 @@ require (
160173
github.com/pkg/errors v0.9.1 // indirect
161174
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
162175
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
163-
github.com/pomerium/csrf v1.7.0 // indirect
164176
github.com/pomerium/datasource v0.18.2-0.20221108160055-c6134b5ed524 // indirect
165177
github.com/pomerium/envoy-custom v1.33.0 // indirect
166178
github.com/pomerium/protoutil v0.0.0-20240813175624-47b7ac43ff46 // indirect
167179
github.com/pomerium/webauthn v0.0.0-20240603205124-0428df511172 // indirect
168180
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
169181
github.com/prometheus/client_golang v1.22.0 // indirect
170182
github.com/prometheus/client_model v0.6.2 // indirect
171-
github.com/prometheus/common v0.63.0 // indirect
183+
github.com/prometheus/common v0.64.0 // indirect
172184
github.com/prometheus/procfs v0.16.1 // indirect
173185
github.com/prometheus/statsd_exporter v0.22.7 // indirect
174186
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
187+
github.com/rogpeppe/go-internal v1.13.1 // indirect
175188
github.com/rs/cors v1.11.1 // indirect
176189
github.com/sagikazarmark/locafero v0.7.0 // indirect
177190
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
@@ -206,22 +219,23 @@ require (
206219
go.opentelemetry.io/contrib/propagators/b3 v1.35.0 // indirect
207220
go.opentelemetry.io/contrib/propagators/jaeger v1.35.0 // indirect
208221
go.opentelemetry.io/contrib/propagators/ot v1.35.0 // indirect
209-
go.opentelemetry.io/otel v1.35.0 // indirect
222+
go.opentelemetry.io/otel v1.36.0 // indirect
210223
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect
211224
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 // indirect
212225
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 // indirect
213-
go.opentelemetry.io/otel/metric v1.35.0 // indirect
214-
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
215-
go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect
216-
go.opentelemetry.io/otel/trace v1.35.0 // indirect
226+
go.opentelemetry.io/otel/exporters/prometheus v0.58.0 // indirect
227+
go.opentelemetry.io/otel/metric v1.36.0 // indirect
228+
go.opentelemetry.io/otel/sdk v1.36.0 // indirect
229+
go.opentelemetry.io/otel/sdk/metric v1.36.0 // indirect
230+
go.opentelemetry.io/otel/trace v1.36.0 // indirect
217231
go.opentelemetry.io/proto/otlp v1.6.0 // indirect
218232
go.uber.org/automaxprocs v1.6.0 // indirect
219233
go.uber.org/multierr v1.11.0 // indirect
220234
go.uber.org/zap/exp v0.3.0 // indirect
221235
golang.org/x/crypto v0.38.0 // indirect
222236
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
223237
golang.org/x/mod v0.24.0 // indirect
224-
golang.org/x/oauth2 v0.29.0 // indirect
238+
golang.org/x/oauth2 v0.30.0 // indirect
225239
golang.org/x/sys v0.33.0 // indirect
226240
golang.org/x/term v0.32.0 // indirect
227241
golang.org/x/text v0.25.0 // indirect

0 commit comments

Comments
 (0)