Merge pull request #3615 from kppullin/fix-l4-external-names
Pass k8s `Service` data through to the TCP balancer script.
This commit is contained in:
commit
c62dc221bf
3 changed files with 15 additions and 0 deletions
|
@ -337,6 +337,7 @@ func (n *NGINXController) getStreamServices(configmapName string, proto apiv1.Pr
|
||||||
ProxyProtocol: svcProxyProtocol,
|
ProxyProtocol: svcProxyProtocol,
|
||||||
},
|
},
|
||||||
Endpoints: endps,
|
Endpoints: endps,
|
||||||
|
Service: svc,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// Keep upstream order sorted to reduce unnecessary nginx config reloads.
|
// Keep upstream order sorted to reduce unnecessary nginx config reloads.
|
||||||
|
|
|
@ -816,19 +816,31 @@ func configureDynamically(pcfg *ingress.Configuration, port int, isDynamicCertif
|
||||||
|
|
||||||
streams := make([]ingress.Backend, 0)
|
streams := make([]ingress.Backend, 0)
|
||||||
for _, ep := range pcfg.TCPEndpoints {
|
for _, ep := range pcfg.TCPEndpoints {
|
||||||
|
var service *apiv1.Service
|
||||||
|
if ep.Service != nil {
|
||||||
|
service = &apiv1.Service{Spec: ep.Service.Spec}
|
||||||
|
}
|
||||||
|
|
||||||
key := fmt.Sprintf("tcp-%v-%v-%v", ep.Backend.Namespace, ep.Backend.Name, ep.Backend.Port.String())
|
key := fmt.Sprintf("tcp-%v-%v-%v", ep.Backend.Namespace, ep.Backend.Name, ep.Backend.Port.String())
|
||||||
streams = append(streams, ingress.Backend{
|
streams = append(streams, ingress.Backend{
|
||||||
Name: key,
|
Name: key,
|
||||||
Endpoints: ep.Endpoints,
|
Endpoints: ep.Endpoints,
|
||||||
Port: intstr.FromInt(ep.Port),
|
Port: intstr.FromInt(ep.Port),
|
||||||
|
Service: service,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for _, ep := range pcfg.UDPEndpoints {
|
for _, ep := range pcfg.UDPEndpoints {
|
||||||
|
var service *apiv1.Service
|
||||||
|
if ep.Service != nil {
|
||||||
|
service = &apiv1.Service{Spec: ep.Service.Spec}
|
||||||
|
}
|
||||||
|
|
||||||
key := fmt.Sprintf("udp-%v-%v-%v", ep.Backend.Namespace, ep.Backend.Name, ep.Backend.Port.String())
|
key := fmt.Sprintf("udp-%v-%v-%v", ep.Backend.Namespace, ep.Backend.Name, ep.Backend.Port.String())
|
||||||
streams = append(streams, ingress.Backend{
|
streams = append(streams, ingress.Backend{
|
||||||
Name: key,
|
Name: key,
|
||||||
Endpoints: ep.Endpoints,
|
Endpoints: ep.Endpoints,
|
||||||
Port: intstr.FromInt(ep.Port),
|
Port: intstr.FromInt(ep.Port),
|
||||||
|
Service: service,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -322,6 +322,8 @@ type L4Service struct {
|
||||||
Backend L4Backend `json:"backend"`
|
Backend L4Backend `json:"backend"`
|
||||||
// Endpoints active endpoints of the service
|
// Endpoints active endpoints of the service
|
||||||
Endpoints []Endpoint `json:"endpoints,omitempty"`
|
Endpoints []Endpoint `json:"endpoints,omitempty"`
|
||||||
|
// k8s Service
|
||||||
|
Service *apiv1.Service `json:"service,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// L4Backend describes the kubernetes service behind L4 Ingress service
|
// L4Backend describes the kubernetes service behind L4 Ingress service
|
||||||
|
|
Loading…
Reference in a new issue