Skip to content

Commit

Permalink
use fqdn to support cross namespace ingresses
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Ryan committed Jan 5, 2024
1 parent c0f9877 commit 838f3b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion internal/configs/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,9 @@ func createUpstream(ingEx *IngressEx, name string, backend *networking.IngressBa
}

if cfg.UseClusterIP {
fqdn := fmt.Sprintf("%s.%s.svc.cluster.local:%d", backend.Service.Name, ingEx.Ingress.Namespace, backend.Service.Port.Number)
upsServers = append(upsServers, version1.UpstreamServer{
Address: fmt.Sprintf("%s:%d", backend.Service.Name, backend.Service.Port.Number),
Address: fqdn,
MaxFails: cfg.MaxFails,
MaxConns: cfg.MaxConns,
FailTimeout: cfg.FailTimeout,
Expand Down
6 changes: 3 additions & 3 deletions internal/configs/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ func createExpectedConfigForMergeableCafeIngressWithUseClusterIP() version1.Ingr
UpstreamZoneSize: upstreamZoneSize,
UpstreamServers: []version1.UpstreamServer{
{
Address: "coffee-svc:80",
Address: "coffee-svc.default.svc.cluster.local:80",
MaxFails: 1,
MaxConns: 0,
FailTimeout: "10s",
Expand Down Expand Up @@ -803,7 +803,7 @@ func createExpectedConfigForCafeIngressWithUseClusterIP() version1.IngressNginxC
UpstreamZoneSize: upstreamZoneSize,
UpstreamServers: []version1.UpstreamServer{
{
Address: "coffee-svc:80",
Address: "coffee-svc.default.svc.cluster.local:80",
MaxFails: 1,
MaxConns: 0,
FailTimeout: "10s",
Expand All @@ -817,7 +817,7 @@ func createExpectedConfigForCafeIngressWithUseClusterIP() version1.IngressNginxC
UpstreamZoneSize: upstreamZoneSize,
UpstreamServers: []version1.UpstreamServer{
{
Address: "tea-svc:80",
Address: "tea-svc.default.svc.cluster.local:80",
MaxFails: 1,
MaxConns: 0,
FailTimeout: "10s",
Expand Down

0 comments on commit 838f3b7

Please sign in to comment.