Skip to content

Zones support, matching by service labels and performance improvements

Choose a tag to compare

@aatarasoff aatarasoff released this 10 May 20:20
· 14 commits to master since this release

Matching only by labels

Ignore the service id entirely and only match using service labels:

customer:
    ribbon:
      <your settings here>
      IgnoreServiceId: true
      MetaDataFilter:
        CUSTOMER_ENTITY: V1
        ENVIRONMENT: UAT

i.e. select any service in the UAT environment that supports Version 1 of the Customer Entity.
Note: The service id of 'customer' is ignored, so all services will be filtered by service label

New equality based selectors

Specify equality based selector on service labels

customer:
    ribbon:
    <your settings here>
    MetaDataFilter:
      API_VERSION: '!=V3'  # not equal to V3; note: must be quoted to keep yaml happy
      ENVIRONMENT: '==DEV' # equal to DEV; note: must be quoted to keep yaml happy
      CUSTOMER_ENTITY: V1  # equal to V1; default is equals

Specify set based selector on service labels

customer:
    ribbon:
    <your settings here>
    MetaDataFilter:
      API_VERSION: in(V1,V2)       # is V1 OR is V2
      ENVIRONMENT: notin(UAT,PROD) # is not UAT AND is not PROD

Zones

Zones support is provided by fetching them from instance's hostname. For example, mesos slaves have hostname like following:

slave1.dc1
slave2.dc1
slave1.dc2
...

There is regexp pattern .+\.(.+) for fetching zone (or datacenter) exists. So, you could define it in service configuration:

customer:
    ribbon:
      <your settings here>
      ZonePattern: '.+\.(.+)'

Finally, you should define zone for app:

spring.cloud.marathon.discovery.zone: dc1

And then different zone-aware filters and rules will be applied.