Pass k8s Service data through to the TCP balancer script.

Fixes broken L4 ExternalName services.

Details
---------

The `tcp_udp_balancer.lua` script checks if the property
`backend.service.spec["type"]` equals "ExternalName".  If so,
the script does a DNS lookup on the name in order to configure
the backend configuration.

However, before this commit, the k8s `Service` data was
_not_ set on the `Backend` struct passed into the `tcp_udp_balancer.lua`
script and therefore the ExternalName check always returned false.

This commit fixes the issue by setting the `Service` field on
the `Backend` struct. This also requires adding a new field to the
`L4Backend` struct first, so that it's available to set on the `Backend`.
This commit is contained in:
Kevin Pullin 2019-01-01 20:35:17 -08:00
parent c3eeaca972
commit f0173f0822
3 changed files with 5 additions and 0 deletions

View file

@ -343,6 +343,7 @@ func (n *NGINXController) getStreamServices(configmapName string, proto apiv1.Pr
ProxyProtocol: svcProxyProtocol,
},
Endpoints: endps,
Service: svc,
})
}
// Keep upstream order sorted to reduce unnecessary nginx config reloads.