动态路由

类groovy脚本动态路由。

  1. apiVersion: service.dubbo.apache.org/v1alpha1
  2. kind: VirtualService
  3. metadata:
  4. name: demo/StandardRouter
  5. spec:
  6. hosts:
  7. - demo
  8. dubbo:
  9. - services:
  10. - exact: com.taobao.hsf.demoservice:1.0.0
  11. routedetail:
  12. - name: sayHello-route
  13. match:
  14. - method:
  15. name_match:
  16. exact: "s-method"
  17. argc: 5
  18. args:
  19. - index: 2
  20. type: double
  21. num_value:
  22. oneof:
  23. - range:
  24. start: 100.1
  25. - index: 1
  26. type: string
  27. str_value:
  28. oneof:
  29. - regex: "*abc*"
  30. - exact: parameter-1
  31. - index: 3
  32. type: bool
  33. - index: 4
  34. type: int
  35. num_value:
  36. oneof:
  37. - range:
  38. start: 1
  39. end: 100
  40. - sourcelables:
  41. sigma.ali/appName: "ump2"
  42. route:
  43. - destination:
  44. host: demo
  45. subset: v1
  46. fallback:
  47. host:demo
  48. subset: v2
  49. - name: default-route
  50. route:
  51. - destination:
  52. host: demo
  53. subset: v2
  54. ---
  55. apiVersion: service.dubbo.apache.org/v1alpha1
  56. kind: DestinationRule
  57. metadata:
  58. name: reviews-route
  59. spec:
  60. host: demo
  61. subsets:
  62. - name: v1
  63. labels:
  64. sigma.ali/mg: v1-host
  65. - name: v2
  66. labels:
  67. sigma.ali/mg: v2-host

最后修改 September 21, 2021: Bug fix miss mialbox (#953) (57cf51b)