Don't merge kubernetes ingresses when priority is set

This commit is contained in:
Daniel Tomcej 2018-08-14 09:40:04 -06:00 committed by Traefiker Bot
parent 278b3180c3
commit bd3c8c3cde
2 changed files with 7 additions and 3 deletions

View file

@ -224,7 +224,12 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error)
} }
for _, pa := range r.HTTP.Paths { for _, pa := range r.HTTP.Paths {
priority := getIntValue(i.Annotations, annotationKubernetesPriority, 0)
baseName := r.Host + pa.Path baseName := r.Host + pa.Path
if priority > 0 {
baseName = strconv.Itoa(priority) + "-" + baseName
}
if _, exists := templateObjects.Backends[baseName]; !exists { if _, exists := templateObjects.Backends[baseName]; !exists {
templateObjects.Backends[baseName] = &types.Backend{ templateObjects.Backends[baseName] = &types.Backend{
Servers: make(map[string]types.Server), Servers: make(map[string]types.Server),
@ -250,7 +255,6 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error)
passHostHeader := getBoolValue(i.Annotations, annotationKubernetesPreserveHost, !p.DisablePassHostHeaders) passHostHeader := getBoolValue(i.Annotations, annotationKubernetesPreserveHost, !p.DisablePassHostHeaders)
passTLSCert := getBoolValue(i.Annotations, annotationKubernetesPassTLSCert, p.EnablePassTLSCert) passTLSCert := getBoolValue(i.Annotations, annotationKubernetesPassTLSCert, p.EnablePassTLSCert)
priority := getIntValue(i.Annotations, annotationKubernetesPriority, 0)
entryPoints := getSliceStringValue(i.Annotations, annotationKubernetesFrontendEntryPoints) entryPoints := getSliceStringValue(i.Annotations, annotationKubernetesFrontendEntryPoints)
templateObjects.Frontends[baseName] = &types.Frontend{ templateObjects.Frontends[baseName] = &types.Frontend{

View file

@ -1849,13 +1849,13 @@ func TestPriorityHeaderValue(t *testing.T) {
expected := buildConfiguration( expected := buildConfiguration(
backends( backends(
backend("foo/bar", backend("1337-foo/bar",
servers(server("http://example.com", weight(1))), servers(server("http://example.com", weight(1))),
lbMethod("wrr"), lbMethod("wrr"),
), ),
), ),
frontends( frontends(
frontend("foo/bar", frontend("1337-foo/bar",
passHostHeader(), passHostHeader(),
priority(1337), priority(1337),
routes( routes(