File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -684,6 +684,12 @@ func (t *Translator) processExtensionRefHTTPFilter(extFilter *v1beta1.LocalObjec
684684 t .processUnresolvedHTTPFilter (errMsg , filterContext )
685685 return
686686 }
687+ if ! t .GlobalRateLimitEnabled {
688+ errMsg := fmt .Sprintf ("Enable Ratelimit in the EnvoyGateway config to configure RateLimitFilter: %s/%s" ,
689+ filterNs , extFilter .Name )
690+ t .processUnresolvedHTTPFilter (errMsg , filterContext )
691+ return
692+ }
687693 rateLimit := & ir.RateLimit {
688694 Global : & ir.GlobalRateLimit {
689695 Rules : make ([]* ir.RateLimitRule , len (rateLimitFilter .Spec .Global .Rules )),
Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ func (r *Runner) subscribeAndTranslate(ctx context.Context) {
5555
5656 // Translate and publish IRs.
5757 t := & gatewayapi.Translator {
58- GatewayClassName : v1beta1 .ObjectName (update .Key ),
58+ GatewayClassName : v1beta1 .ObjectName (update .Key ),
59+ GlobalRateLimitEnabled : r .EnvoyGateway .RateLimit != nil ,
5960 }
6061 // Translate to IR
6162 result := t .Translate (val )
Original file line number Diff line number Diff line change @@ -57,6 +57,10 @@ type Translator struct {
5757 // the Infra IR. If unspecified, the default proxy
5858 // image will be used.
5959 ProxyImage string
60+
61+ // GlobalRateLimitEnabled is true when global
62+ // ratelimiting has been configured by the admin.
63+ GlobalRateLimitEnabled bool
6064}
6165
6266type TranslateResult struct {
Original file line number Diff line number Diff line change @@ -47,8 +47,9 @@ func TestTranslate(t *testing.T) {
4747 mustUnmarshal (t , string (output ), want )
4848
4949 translator := & Translator {
50- GatewayClassName : "envoy-gateway-class" ,
51- ProxyImage : "envoyproxy/envoy:translator-tests" ,
50+ GatewayClassName : "envoy-gateway-class" ,
51+ ProxyImage : "envoyproxy/envoy:translator-tests" ,
52+ GlobalRateLimitEnabled : true ,
5253 }
5354
5455 // Add common test fixtures
You can’t perform that action at this time.
0 commit comments