1
0
Fork 0

Mapping ExternalNames to custom ports

This commit is contained in:
Gildas Cherruel 2018-05-18 01:46:03 +09:00 committed by Traefiker Bot
parent 5a1d2aa4b6
commit c37b040217
2 changed files with 52 additions and 7 deletions

View file

@ -270,13 +270,16 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error)
protocol := label.DefaultProtocol
for _, port := range service.Spec.Ports {
if equalPorts(port, pa.Backend.ServicePort) {
if port.Port == 443 {
if port.Port == 443 || strings.HasPrefix(port.Name, "https") {
protocol = "https"
}
if service.Spec.Type == "ExternalName" {
url := protocol + "://" + service.Spec.ExternalName
name := url
if port.Port != 443 && port.Port != 80 {
url = fmt.Sprintf("%s:%d", url, port.Port)
}
templateObjects.Backends[baseName].Servers[name] = types.Server{
URL: url,