fmartinou opened a new issue, #13184:
URL: https://github.com/apache/apisix/issues/13184

   ### Description
   
   Hello,
   
   I try to configure APISIX to implement canary deployment on microservices 
registered to Consul.
   
   Basically,
   - I register multiple service instances sharing the same logical "service 
name" on Consul
   - I tag every instance (using tags or metadata) to differentiate "_stable_" 
instances from "_canary_" instances.
   
   See below an example of Consul registration:
   
   ```
   # Register stable my_service instance
   curl  -X PUT http://localhost:8500/v1/agent/service/register -H 
"Content-Type: application/json" \
       -d '{
           "ID": "my_service_stable",
           "Name": "my_service",
           "Address": "192.xxx",
           "Tags": ["stable"],
           "Meta": {
               "version": "stable"
           }
       }'
   
   # Register canary my_service instance
   curl  -X PUT http://localhost:8500/v1/agent/service/register -H 
"Content-Type: application/json" \
       -d '{
           "ID": "my_service_canary",
           "Name": "my_service",
           "Address": "192.xxx",
           "Tags": ["canary"],
           "Meta": {
               "version": "canary"
           }
       }'
   ```
   
   On Consul, it looks like:
   
   <img width="1091" height="540" alt="Image" 
src="https://github.com/user-attachments/assets/298a3aa8-ab9d-44a5-98c5-3f2e33ff1481";
 />
   
   
   Then, on APISIX, I would like to split my traffic according to these tags or 
metadata values.
   
   Something like:
   (_metadata_match_ is here for illustration only; it's the purpose of this 
issue)
   ```
   curl -H "X-API-KEY: $APISIX_ADMIN_KEY"  -X PUT 
http://localhost:9180/apisix/admin/routes/route_my_service \
       -d '{
           "uri": "/my_service",
           "plugins": {
               "traffic-split": {
                   "rules": [
                       {
                           "weighted_upstreams": [
                               {
                                   "weight": 80,
                                   "upstream": {
                                       {
                                           "type": "roundrobin",
                                           "service_name": "dummy",
                                           "discovery_type": "consul",
                                           "discovery_args": {
                                               "metadata_match": { "version": 
["stable"] }
                                           }
                                       }
                                   }
                               },
                               {
                                   "weight": 20,
                                   "upstream": {
                                       {
                                           "type": "roundrobin",
                                           "service_name": "dummy",
                                           "discovery_type": "consul",
                                           "discovery_args": {
                                               "metadata_match": { "version": 
["canary"] }
                                           }
                                       }
                                   }
                               },
   
                           ]
                       }
                   ]
               }
           }
       }'
   ```
   
   Unfortunately, filtering/matching seems not to be supported now; am I right?
   
   So currently, the only way I found so far is to create separate services on 
Consul (one named _stable_ and one named _canary_) but it's a workaround 
(Consul service registry is made to group all service instances into a common 
logical service).
   
   In the APISIX git history, I found [this 
commit](https://github.com/apache/apisix/blob/b61504bb4199f7683ad3f7bc6a1fabfc7d0ea30a/t/discovery/consul.t#L855-L997)
 that was illustrating what I wish by a test; is this feature already coded? 
planned?
   
   Thank you for your great work.
   Best regards


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to