Skip to content
This repository was archived by the owner on Jan 26, 2023. It is now read-only.

Commit 79440ec

Browse files
author
Greg Dubicki
committed
Put nodes in haproxy backends sorted by name
1 parent 632147f commit 79440ec

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

consul/watcher.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"crypto/x509"
55
"fmt"
66
"reflect"
7+
"sort"
78
"sync"
89
"time"
910

@@ -484,6 +485,10 @@ func (w *Watcher) genCfg() Config {
484485
})
485486
}
486487

488+
sort.Slice(upstream.Nodes, func(i, j int) bool {
489+
return upstream.Nodes[i].Name < upstream.Nodes[j].Name
490+
})
491+
487492
config.Upstreams = append(config.Upstreams, upstream)
488493
}
489494

0 commit comments

Comments
 (0)