-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkuadrant_spec_limitador.yaml
210 lines (210 loc) · 3.75 KB
/
kuadrant_spec_limitador.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
apiVersion: v1
kind: Secret
metadata:
name: redisconfig
stringData:
URL: redis://redis.default.svc.cluster.local/0
type: Opaque
---
apiVersion: v1
kind: Service
metadata:
name: redis
spec:
ports:
- port: 6379
protocol: TCP
targetPort: 6379
selector:
app: redis
---
apiVersion: v1
kind: Service
metadata:
name: toystore
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 3000
selector:
app: toystore
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- image: redis:latest
name: redis
ports:
- containerPort: 6379
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: toystore
name: toystore
spec:
replicas: 1
selector:
matchLabels:
app: toystore
template:
metadata:
labels:
app: toystore
spec:
containers:
- env:
- name: PORT
value: "3000"
image: quay.io/3scale/authorino:echo-api
name: toystore
ports:
- containerPort: 3000
name: http
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
labels:
app: dollstore
name: dollstore
spec:
hostnames:
- '*.toystore.com'
parentRefs:
- name: istio-ingressgateway
namespace: istio-system
rules:
- backendRefs:
- name: toystore
port: 80
matches:
- method: GET
path:
type: PathPrefix
value: /doll
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
labels:
app: toystore
name: toystore
spec:
hostnames:
- '*.toystore.com'
parentRefs:
- name: istio-ingressgateway
namespace: istio-system
rules:
- backendRefs:
- name: toystore
port: 80
matches:
- method: GET
path:
type: PathPrefix
value: /toy
---
apiVersion: kuadrant.io/v1beta1
kind: Kuadrant
metadata:
name: kuadrant-sample
spec:
limitador:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app.kubernetes.io/name: limitador
topologyKey: kubernetes.io/hostname
weight: 100
- podAffinityTerm:
labelSelector:
matchLabels:
app.kubernetes.io/name: limitador
topologyKey: topology.kubernetes.io/zone
weight: 99
pdb:
maxUnavailable: 1
replicas: 3
resourceRequirements:
limits:
cpu: 200m
memory: 400Mi
requests:
cpu: 101m
memory: 201Mi
storage:
redis:
configSecretRef:
name: redisconfig
---
apiVersion: kuadrant.io/v1beta2
kind: RateLimitPolicy
metadata:
name: dollstore
spec:
limits:
toystore:
counters:
- request.url_path
rates:
- duration: 5
limit: 1
unit: second
routeSelectors:
- hostnames:
- '*.toystore.com'
matches:
- method: GET
path:
type: PathPrefix
value: /doll
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: dollstore
---
apiVersion: kuadrant.io/v1beta2
kind: RateLimitPolicy
metadata:
name: toystore
spec:
limits:
toystore:
counters:
- request.url_path
rates:
- duration: 10
limit: 5
unit: second
routeSelectors:
- hostnames:
- '*.toystore.com'
matches:
- method: GET
path:
type: Exact
value: /toy
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: toystore