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 {
priority := getIntValue(i.Annotations, annotationKubernetesPriority, 0)
baseName := r.Host + pa.Path
if priority > 0 {
baseName = strconv.Itoa(priority) + "-" + baseName
}
if _, exists := templateObjects.Backends[baseName]; !exists {
templateObjects.Backends[baseName] = &types.Backend{
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)
passTLSCert := getBoolValue(i.Annotations, annotationKubernetesPassTLSCert, p.EnablePassTLSCert)
priority := getIntValue(i.Annotations, annotationKubernetesPriority, 0)
entryPoints := getSliceStringValue(i.Annotations, annotationKubernetesFrontendEntryPoints)
templateObjects.Frontends[baseName] = &types.Frontend{

View file

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