DestinationRule

目标地址规则

DestinationRule

DestinationRule用来处理目标地址的规则,与DestinationRule相关的ServiceEntry, WorkloadEntry等定义与开源保持一致

  • 使用示例
  1. apiVersion: service.dubbo.apache.org/v1alpha1
  2. kind: DestinationRule
  3. metadata:
  4. name: demo-route
  5. spec:
  6. host: demo
  7. subsets:
  8. trafficPolicy:
  • 属性说明
FieldTypeDescriptionRequired
namestring规则的名字,方便识别规则用意YES
hoststring注册中心里面对应的key值,现在是接口名YES
trafficPolicyTrafficPolicy流量策略NO
subsetsSubset[]服务的单一版本或多版本的命名YES

Subset

Subset应用服务的命名,可以是单个也可以是多个版本

  • 使用示例
  1. apiVersion: service.dubbo.apache.org/v1alpha1
  2. kind: DestinationRule
  3. metadata:
  4. name: demo-route
  5. spec:
  6. subsets: #Subnet[]
  7. - name:
  8. labels:
  • 属性说明
FieldTypeDescriptionRequired
namestring服务版本名称YES
labelsmap<string, string>打在服务身上的标签YES

TrafficPolicy

TrafficPolicy表示负载均衡策略

  • 使用示例
  1. apiVersion: service.dubbo.apache.org/v1alpha1
  2. kind: DestinationRule
  3. metadata:
  4. name: demo-route
  5. spec:
  6. trafficPolicy: #TrafficPolicy
  7. loadBalancer:
  • 属性说明
FieldTypeDescriptionRequired
loadBalancerLoadBalancerSettings负载均衡设置YES

LoadBalancerSettings

LoadBalancerSettings用来表示负载均衡相关的配置

  • 使用示例
  1. apiVersion: service.dubbo.apache.org/v1alpha1
  2. kind: DestinationRule
  3. metadata:
  4. name: demo-route
  5. spec:
  6. trafficPolicy:
  7. loadBalancer: #LoadBalancerSettings
  8. simple:
  9. consistentHash:
  • 属性说明
FieldTypeDescriptionRequired
simplestring负载均衡策略,其中包括:ROUND_ROBIN, LEAST_CONN, RANDOM, PASSTHROUGHYES
consistentHashConsistentHashLB一致性Hash策略(未实现) NO
NO

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