Skip to content

Commit ccfb718

Browse files
committed
Expanded the load balanced ports to cover more services.
1 parent d71f2cd commit ccfb718

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

deployment/dockerdeploy/controller.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"fmt"
99
"io"
1010
"net/http"
11+
"strconv"
1112
"strings"
1213
"time"
1314

@@ -382,8 +383,10 @@ func (c *Controller) UpdateNginxConfig(ctx context.Context, containerID string,
382383
c.Logger.Debug("writing nginx config", zap.String("container", containerID), zap.Any("addrs", addrs))
383384

384385
var nginxConf string
385-
writeForwardedPort := func(port string, stickySession bool) {
386+
writeForwardedPort := func(portInt int, stickySession bool) {
386387
if len(addrs) > 0 {
388+
port := strconv.Itoa(portInt)
389+
387390
nginxConf += "upstream backend" + port + " {\n"
388391
if stickySession {
389392
nginxConf += " ip_hash;\n"
@@ -403,12 +406,13 @@ func (c *Controller) UpdateNginxConfig(ctx context.Context, containerID string,
403406
nginxConf += "}\n"
404407
}
405408
}
406-
writeForwardedPort("8091", true)
407-
writeForwardedPort("8092", false)
408-
writeForwardedPort("8093", false)
409-
writeForwardedPort("8094", false)
410-
writeForwardedPort("8095", false)
411-
writeForwardedPort("8096", false)
409+
writeForwardedPort(8091, true)
410+
writeForwardedPort(8092, false)
411+
writeForwardedPort(8093, false)
412+
writeForwardedPort(8094, false)
413+
writeForwardedPort(8095, false)
414+
writeForwardedPort(8096, false)
415+
writeForwardedPort(8097, false)
412416

413417
confBytes := []byte(nginxConf)
414418

0 commit comments

Comments
 (0)