Skip to content

Commit 0449045

Browse files
fabianonunesoktalz
authored andcommitted
BUG/MINOR: bind TCP services on adresses passed via flags --ipv4-bind-address and --ipv6-bind-address
1 parent c32e5b2 commit 0449045

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

controller/handler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ func (c *HAProxyController) initHandlers() {
4545
handler.TCPServices{
4646
SetDefaultService: c.setDefaultService,
4747
CertDir: c.Cfg.Env.FrontendCertDir,
48+
AddrIPv4: c.OSArgs.IPV4BindAddr,
49+
AddrIPv6: c.OSArgs.IPV6BindAddr,
4850
},
4951
handler.PatternFiles{},
5052
handler.Refresh{},

controller/handler/tcp-services.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import (
1515
type TCPServices struct {
1616
SetDefaultService func(ingress *store.Ingress, frontends []string) (reload bool, err error)
1717
CertDir string
18+
AddrIPv4 string
19+
AddrIPv6 string
1820
}
1921

2022
type tcpSvcParser struct {
@@ -113,11 +115,11 @@ func (t TCPServices) createTCPFrontend(api api.HAProxyClient, frontendName, bind
113115
var errors utils.Errors
114116
errors.Add(api.FrontendCreate(frontend))
115117
errors.Add(api.FrontendBindCreate(frontendName, models.Bind{
116-
Address: "0.0.0.0:" + bindPort,
118+
Address: t.AddrIPv4 + ":" + bindPort,
117119
Name: "v4",
118120
}))
119121
errors.Add(api.FrontendBindCreate(frontendName, models.Bind{
120-
Address: ":::" + bindPort,
122+
Address: t.AddrIPv6 + ":" + bindPort,
121123
Name: "v6",
122124
V4v6: true,
123125
}))

0 commit comments

Comments
 (0)