Use of rancher-compose variable in label name

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.: ${es_url}:${es_port}=${es_port}${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?


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:

       - 80:80
       image: rancher/load-balancer-service
       - {$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}
        # Put load balancer containers only on hosts without label availability=temporal
         io.rancher.scheduler.affinity:host_label_ne: availability=temporal
        # Requests to should be routed to web1 over port 8000
  {$stack_1}/{$service_1}: {$subdomain_1}.{$hostname}:80={$port_1}
    #{$stack_2}/{$service_2}: {$subdomain_2}.{$hostname}:80={$port_2}
    #{$stack_3}/{$service_3}: {$subdomain_3}.{$hostname}:80={$port_3}
    #{$stack_4}/{$service_4}: {$subdomain_4}.{$hostname}:80={$port_4}
    #{$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 ( ).