Skip to content

Commit 9adfed3

Browse files
Remove networkingRef from RateLimitPolicy (Kuadrant#86)
* remove networkingRef from RateLimitPolicy * fix lint errors * update samples for RLP * update sample RLP to include vhost level RateLimit
1 parent 2464ad5 commit 9adfed3

12 files changed

+410
-245
lines changed

apis/apim/v1alpha1/ratelimitpolicy_types.go

-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ type NetworkingRef struct {
8787

8888
// RateLimitPolicySpec defines the desired state of RateLimitPolicy
8989
type RateLimitPolicySpec struct {
90-
//+listType=map
91-
//+listMapKey=type
92-
//+listMapKey=name
93-
NetworkingRef []NetworkingRef `json:"networkingRef,omitempty"`
9490
// route specific staging and actions
9591
//+listType=map
9692
//+listMapKey=name

apis/apim/v1alpha1/zz_generated.deepcopy.go

-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/apim.kuadrant.io_ratelimitpolicies.yaml

-19
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,6 @@ spec:
6262
- variables
6363
type: object
6464
type: array
65-
networkingRef:
66-
items:
67-
properties:
68-
name:
69-
type: string
70-
type:
71-
enum:
72-
- HTTPRoute
73-
- VirtualService
74-
type: string
75-
required:
76-
- name
77-
- type
78-
type: object
79-
type: array
80-
x-kubernetes-list-map-keys:
81-
- type
82-
- name
83-
x-kubernetes-list-type: map
8465
rateLimits:
8566
description: RateLimits are used for all of the matching rules
8667
items:

config/deploy/manifests.yaml

-19
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,6 @@ spec:
138138
- variables
139139
type: object
140140
type: array
141-
networkingRef:
142-
items:
143-
properties:
144-
name:
145-
type: string
146-
type:
147-
enum:
148-
- HTTPRoute
149-
- VirtualService
150-
type: string
151-
required:
152-
- name
153-
- type
154-
type: object
155-
type: array
156-
x-kubernetes-list-map-keys:
157-
- type
158-
- name
159-
x-kubernetes-list-type: map
160141
rateLimits:
161142
description: RateLimits are used for all of the matching rules
162143
items:
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,48 @@
1+
---
12
apiVersion: apim.kuadrant.io/v1alpha1
23
kind: RateLimitPolicy
34
metadata:
4-
name: ratelimitpolicy-sample
5-
namespace: kuadrant-system
6-
labels:
7-
app: toystore
5+
name: toystore
86
spec:
9-
networkingRef:
10-
- type: VirtualService
11-
name: toystore
127
routes:
138
- name: get-toy
14-
stage: BOTH
15-
actions:
16-
- generic_key:
17-
descriptor_key: get
18-
descriptor_value: "yes"
9+
rateLimits:
10+
- stage: BOTH
11+
actions:
12+
- generic_key:
13+
descriptor_key: get-toy
14+
descriptor_value: "yes"
15+
- generic_key:
16+
descriptor_key: other-get-toy
17+
descriptor_value: "yes"
1918
- name: add-toy
20-
stage: POSTAUTH
19+
rateLimits:
20+
- stage: POSTAUTH
21+
actions:
22+
- generic_key:
23+
descriptor_key: add-toy
24+
descriptor_value: "yes"
25+
- name: delete-toy
26+
rateLimits:
27+
- stage: PREAUTH
28+
actions:
29+
- generic_key:
30+
descriptor_key: delete-toy
31+
descriptor_value: "yes"
32+
rateLimits:
33+
- stage: PREAUTH
2134
actions:
2235
- generic_key:
23-
descriptor_key: admin
36+
descriptor_key: vhaction
2437
descriptor_value: "yes"
2538
limits:
26-
- conditions: ["admin == yes"]
39+
- conditions: ["get-toy == yes"]
2740
max_value: 2
28-
namespace: postauth
41+
namespace: preauth
42+
seconds: 15
43+
variables: []
44+
- condtitions: ["vhaction == yes"]
45+
max_value: 4
46+
namespace: preauth
2947
seconds: 15
3048
variables: []

0 commit comments

Comments
 (0)