Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. ---
  2. apiVersion: config.istio.io/v1alpha2
  3. kind: memquota
  4. metadata:
  5. name: handler
  6. spec:
  7. quotas:
  8. - name: requestcount.quota.istio-system
  9. maxAmount: 500
  10. validDuration: 1s
  11. # The first matching override is applied.
  12. # A requestcount instance is checked against override dimensions.
  13. overrides:
  14. # The following override applies to 'reviews' regardless
  15. # of the source.
  16. - dimensions:
  17. destination: recommendation
  18. maxAmount: 4
  19. validDuration: 5s
  20. ---
  21. apiVersion: config.istio.io/v1alpha2
  22. kind: quota
  23. metadata:
  24. name: requestcount
  25. spec:
  26. dimensions:
  27. source: request.headers["x-forwarded-for"] | "unknown"
  28. destination: destination.labels["app"] | destination.service.name | "unknown"
  29. destinationVersion: destination.labels["version"] | "unknown"
  30. ---
  31. apiVersion: config.istio.io/v1alpha2
  32. kind: QuotaSpec
  33. metadata:
  34. name: request-count
  35. spec:
  36. rules:
  37. - quotas:
  38. - charge: 1
  39. quota: requestcount
  40. ---
  41. apiVersion: config.istio.io/v1alpha2
  42. kind: QuotaSpecBinding
  43. metadata:
  44. name: request-count
  45. spec:
  46. quotaSpecs:
  47. - name: request-count
  48. namespace: USERNAME-smcp
  49. services:
  50. - name: recommendation
  51. namespace: USERNAME-tutorial
  52. # - service: '*' # Uncomment this to bind *all* services to request-count
  53. ---
  54. apiVersion: config.istio.io/v1alpha2
  55. kind: rule
  56. metadata:
  57. name: quota
  58. spec:
  59. # quota only applies if you are not logged in.
  60. # match: match(request.headers["cookie"], "user=*") == false
  61. actions:
  62. - handler: handler.memquota
  63. instances:
  64. - requestcount.quota
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement