Add entrypoints prefix in kubernetes frontend/backend id

This commit is contained in:
Julien Salleyron
2019-03-28 14:22:05 +01:00
committed by Traefiker Bot
parent 30545808d9
commit 305af43fb9
2 changed files with 11 additions and 7 deletions

View File

@@ -245,6 +245,11 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error)
baseName = pa.Backend.ServiceName
}
entryPoints := getSliceStringValue(i.Annotations, annotationKubernetesFrontendEntryPoints)
if len(entryPoints) > 0 {
baseName = strings.Join(entryPoints, "-") + "_" + baseName
}
if priority > 0 {
baseName = strconv.Itoa(priority) + "-" + baseName
}
@@ -277,7 +282,6 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error)
passHostHeader := getBoolValue(i.Annotations, annotationKubernetesPreserveHost, !p.DisablePassHostHeaders)
passTLSCert := getBoolValue(i.Annotations, annotationKubernetesPassTLSCert, p.EnablePassTLSCert) // Deprecated
entryPoints := getSliceStringValue(i.Annotations, annotationKubernetesFrontendEntryPoints)
frontend = &types.Frontend{
Backend: baseName,

View File

@@ -1509,7 +1509,7 @@ rateset:
server("http://example.com", weight(1))),
lbMethod("wrr"),
),
backend("other/",
backend("http-https_other/",
servers(
server("http://example.com", weight(1)),
server("http://example.com", weight(1))),
@@ -1617,7 +1617,7 @@ rateset:
route("/stuff", "PathPrefix:/stuff"),
route("other", "Host:other")),
),
frontend("other/",
frontend("http-https_other/",
passHostHeader(),
entryPoints("http", "https"),
routes(
@@ -2836,24 +2836,24 @@ func TestTLSSecretLoad(t *testing.T) {
expected := buildConfiguration(
backends(
backend("example.com",
backend("ep1-ep2_example.com",
servers(),
lbMethod("wrr"),
),
backend("example.org",
backend("ep1-ep2_example.org",
servers(),
lbMethod("wrr"),
),
),
frontends(
frontend("example.com",
frontend("ep1-ep2_example.com",
entryPoints("ep1", "ep2"),
passHostHeader(),
routes(
route("example.com", "Host:example.com"),
),
),
frontend("example.org",
frontend("ep1-ep2_example.org",
entryPoints("ep1", "ep2"),
passHostHeader(),
routes(