Use of rancher-compose variable in label name

Hi.
I’m trying to create a stack for a “universal” load balancer for all the services in my env: elastic, rabbit, my webapps etc.
Since I want to be able to use custom stacks names of all the services ad deploy time, I’m adding a set of option blocks to the balancer’s rancher-compose.
Then I need to bring these stack/service combinations in the docker-compose’s labels dedicated to the balancers, e.g.:

    io.rancher.loadbalancer.target.elasticsearch-clients: ${es_url}:${es_port}=${es_port}
    io.rancher.loadbalancer.target.${elastic_service}: ${es_url}:${es_port}=${es_port}

where ${elastic_service} is the value of an option control in rancher-compose.

The label in the second variable is not expanded as I hoped.
Is there any way to make it work or to get a workaround to this?

thanks

I am also trying to automate the creation of a load-balancer for my project but: I am not even able to use a rancher-compose variable with external links. This is what I am trying to accomplish:

  lb:
  
  
       ports:
  
  
       - 80:80
  
  
       image: rancher/load-balancer-service
  
  
       external_links:
  
  
       - {$stack_1}/{$service_1}:{$service_1}
  
  
    #   - {$stack_2}/{$service_2}:{$service_2}
  
  
    #   - {$stack_3}/{$service_3}:{$service_3}
  
  
    #   - {$stack_4}/{$service_4}:{$service_4}
  
  
    #   - {$stack_5}/{$service_5}:{$service_5}
  
  
       labels:
  
  
        # Put load balancer containers only on hosts without label availability=temporal
  
  
         io.rancher.scheduler.affinity:host_label_ne: availability=temporal
  
  
        # Requests to http://app.example.com/foo:80 should be routed to web1 over port 8000
  
  
         io.rancher.loadbalancer.target.{$stack_1}/{$service_1}: {$subdomain_1}.{$hostname}:80={$port_1}
  
  
    #     io.rancher.loadbalancer.target.{$stack_2}/{$service_2}: {$subdomain_2}.{$hostname}:80={$port_2}
  
  
    #     io.rancher.loadbalancer.target.{$stack_3}/{$service_3}: {$subdomain_3}.{$hostname}:80={$port_3}
  
  
    #     io.rancher.loadbalancer.target.{$stack_4}/{$service_4}: {$subdomain_4}.{$hostname}:80={$port_4}
  
  
    #     io.rancher.loadbalancer.target.{$stack_5}/{$service_5}: {$subdomain_5}.{$hostname}:80={$port_5}

Variables are not replaced in libcompose on map keys, only on the values.

An upcoming release will have a better syntax for defining balancers that isn’t generating crazy labels ( https://github.com/rancher/rancher/issues/2179 ).