Service Labels support
Sometimes it is useful discover services that are advertising a specific capability; by API version for example:
Three versions of a service have been deployed, with the following Marathon service ids and labels:
/group1/path/app "labels":{ "API_VERSION" : "V1" }
/group2/path/app "labels":{ "API_VERSION" : "V2" }
/group3/path/app "labels":{ "API_VERSION" : "V2" }
A client is configured to expect the "V2" API Version:
app:
ribbon:
<your settings are here>
MetaDataFilter:
API_VERSION: V2Only service instances that contain "app" in the service id and have matching labels will be discovered & used by ribbon.
Where multiple values are specified for MetaDataFilter, all values must match service labels before ribbon will use the service instance:
app:
ribbon:
<your settings are here>
MetaDataFilter:
API_VERSION: V2
ENVIRONMENT: UAT
APPLICATION_OWNER: fred.bloggs@company.comCombining the loose service id matching with service label filtering permits us to get creative with service discovery:
group.path:
ribbon:
<your settings are here>
MetaDataFilter:
CUSTOMER_ENTITY: V1i.e. select any service deployed to /group/path that supports Version 1 of the Customer Entity
Thanks to @tegataiprime