Fix GroupsAsSubDomains option for Mesos and Marathon (#868)

* Fix GroupsAsSubDomains option for Mesos and Marathon
* Refactor reverseStringSlice function
This commit is contained in:
Ryan Leary 2016-11-28 08:59:08 -05:00 committed by Emile Vauge
parent e34c364d5e
commit 055cd01bb7
5 changed files with 73 additions and 7 deletions

View file

@ -7,6 +7,8 @@ import (
"text/template"
"fmt"
"time"
"github.com/BurntSushi/ty/fun"
"github.com/cenk/backoff"
"github.com/containous/traefik/job"
@ -20,8 +22,6 @@ import (
"github.com/mesosphere/mesos-dns/records"
"github.com/mesosphere/mesos-dns/records/state"
"github.com/mesosphere/mesos-dns/util"
"sort"
"time"
)
var _ Provider = (*Mesos)(nil)
@ -435,7 +435,7 @@ func Ignore(f ErrorFunction) {
func (provider *Mesos) getSubDomain(name string) string {
if provider.GroupsAsSubDomains {
splitedName := strings.Split(strings.TrimPrefix(name, "/"), "/")
sort.Sort(sort.Reverse(sort.StringSlice(splitedName)))
reverseStringSlice(&splitedName)
reverseName := strings.Join(splitedName, ".")
return reverseName
}