Kuadrant / kuadrant-controller

Apache License 2.0
12 stars 7 forks source link

ratelimitpolicy controller: targetref #140

Closed eguzki closed 2 years ago

eguzki commented 2 years ago

what

RateLimitPolicy implementing Gateway API's Policy Attachment Target Reference API

---
apiVersion: apim.kuadrant.io/v1alpha1
kind: RateLimitPolicy
metadata:
  name: toystore
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: toystore

Currently only HTTPRoutes can be targeted.

Additionally:

Verification Steps

Follow Getting Started

Fixes #123

Verification Steps (referenced gateway changes)

The PR includes a deployment of a second gateway with key kuadrant-system/other-gwapi-gateway

kubectl get envoyfilter kuadrant-other-gwapi-gateway-wasm-ratelimits -o yaml -n kuadrant-system | yq_k8s_clean | grep -A 1 type.googleapis.com/google.protobuf.StringValue
                  '@type': type.googleapis.com/google.protobuf.StringValue
                  value: '{"failure_mode_deny":true,"ratelimitpolicies":{"default/toystore":{"hosts":["*.toystore.com"],"rules":[{"operations":[{"paths":["/toy"],"methods":["GET"]}],"actions":[{"generic_key":{"descriptor_value":"yes","descriptor_key":"get-toy"}}]}],"global_actions":[{"generic_key":{"descriptor_value":"yes","descriptor_key":"vhaction"}}],"upstream_cluster":"rate-limit-cluster","domain":"toystore-app"}}}'

TODO

rahulanand16nov commented 2 years ago

is this ready for review?

eguzki commented 2 years ago

It's ready for review, but still WIP.

eguzki commented 2 years ago

@rahulanand16nov the PR is fully implemented. Ready for final review and merge if approved

eguzki commented 2 years ago

Wow, that was a long PR! looking good overall +1

Sorry about that! It should not be like that.