Adds the missing circuit-breaker response code for CRD

This commit is contained in:
Ludovic Fernandez 2024-04-19 11:26:05 +02:00 committed by GitHub
parent a6b00608d2
commit 95312d5324
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 18 additions and 0 deletions

View file

@ -814,6 +814,10 @@ spec:
breaker will try to recover (as soon as it is in recovering breaker will try to recover (as soon as it is in recovering
state). state).
x-kubernetes-int-or-string: true x-kubernetes-int-or-string: true
responseCode:
description: ResponseCode is the status code that the circuit
breaker will return while it is in the open state.
type: integer
type: object type: object
compress: compress:
description: |- description: |-

View file

@ -172,6 +172,10 @@ spec:
breaker will try to recover (as soon as it is in recovering breaker will try to recover (as soon as it is in recovering
state). state).
x-kubernetes-int-or-string: true x-kubernetes-int-or-string: true
responseCode:
description: ResponseCode is the status code that the circuit
breaker will return while it is in the open state.
type: integer
type: object type: object
compress: compress:
description: |- description: |-

View file

@ -814,6 +814,10 @@ spec:
breaker will try to recover (as soon as it is in recovering breaker will try to recover (as soon as it is in recovering
state). state).
x-kubernetes-int-or-string: true x-kubernetes-int-or-string: true
responseCode:
description: ResponseCode is the status code that the circuit
breaker will return while it is in the open state.
type: integer
type: object type: object
compress: compress:
description: |- description: |-

View file

@ -645,6 +645,10 @@ func createCircuitBreakerMiddleware(circuitBreaker *traefikv1alpha1.CircuitBreak
} }
} }
if circuitBreaker.ResponseCode != 0 {
cb.ResponseCode = circuitBreaker.ResponseCode
}
return cb, nil return cb, nil
} }

View file

@ -88,6 +88,8 @@ type CircuitBreaker struct {
FallbackDuration *intstr.IntOrString `json:"fallbackDuration,omitempty" toml:"fallbackDuration,omitempty" yaml:"fallbackDuration,omitempty" export:"true"` FallbackDuration *intstr.IntOrString `json:"fallbackDuration,omitempty" toml:"fallbackDuration,omitempty" yaml:"fallbackDuration,omitempty" export:"true"`
// RecoveryDuration is the duration for which the circuit breaker will try to recover (as soon as it is in recovering state). // RecoveryDuration is the duration for which the circuit breaker will try to recover (as soon as it is in recovering state).
RecoveryDuration *intstr.IntOrString `json:"recoveryDuration,omitempty" toml:"recoveryDuration,omitempty" yaml:"recoveryDuration,omitempty" export:"true"` RecoveryDuration *intstr.IntOrString `json:"recoveryDuration,omitempty" toml:"recoveryDuration,omitempty" yaml:"recoveryDuration,omitempty" export:"true"`
// ResponseCode is the status code that the circuit breaker will return while it is in the open state.
ResponseCode int `json:"responseCode,omitempty" toml:"responseCode,omitempty" yaml:"responseCode,omitempty" export:"true"`
} }
// +k8s:deepcopy-gen=true // +k8s:deepcopy-gen=true