mirror of
https://github.com/traefik/traefik.git
synced 2025-12-04 17:11:30 +01:00
Fix the service name for ingress-nginx provider
This commit is contained in:
parent
14a1aedf57
commit
ef03ed5875
@ -453,7 +453,7 @@ func (p *Provider) loadConfiguration(ctx context.Context) *dynamic.Configuration
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: if no service, do not add middlewares and 503.
|
// TODO: if no service, do not add middlewares and 503.
|
||||||
serviceName := provider.Normalize(ingress.Namespace + "-" + pa.Backend.Service.Name + "-" + portString)
|
serviceName := provider.Normalize(ingress.Namespace + "-" + ingress.Name + "-" + pa.Backend.Service.Name + "-" + portString)
|
||||||
|
|
||||||
service, err := p.buildService(ingress.Namespace, pa.Backend, ingressConfig)
|
service, err := p.buildService(ingress.Namespace, pa.Backend, ingressConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -64,7 +64,7 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
Rule: "Host(`whoami.localhost`) && Path(`/basicauth`)",
|
Rule: "Host(`whoami.localhost`) && Path(`/basicauth`)",
|
||||||
RuleSyntax: "default",
|
RuleSyntax: "default",
|
||||||
Middlewares: []string{"default-ingress-with-basicauth-rule-0-path-0-basic-auth"},
|
Middlewares: []string{"default-ingress-with-basicauth-rule-0-path-0-basic-auth"},
|
||||||
Service: "default-whoami-80",
|
Service: "default-ingress-with-basicauth-whoami-80",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Middlewares: map[string]*dynamic.Middleware{
|
Middlewares: map[string]*dynamic.Middleware{
|
||||||
@ -78,7 +78,7 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Services: map[string]*dynamic.Service{
|
Services: map[string]*dynamic.Service{
|
||||||
"default-whoami-80": {
|
"default-ingress-with-basicauth-whoami-80": {
|
||||||
LoadBalancer: &dynamic.ServersLoadBalancer{
|
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||||
Servers: []dynamic.Server{
|
Servers: []dynamic.Server{
|
||||||
{
|
{
|
||||||
@ -119,7 +119,7 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
Rule: "Host(`whoami.localhost`) && Path(`/forwardauth`)",
|
Rule: "Host(`whoami.localhost`) && Path(`/forwardauth`)",
|
||||||
RuleSyntax: "default",
|
RuleSyntax: "default",
|
||||||
Middlewares: []string{"default-ingress-with-forwardauth-rule-0-path-0-forward-auth"},
|
Middlewares: []string{"default-ingress-with-forwardauth-rule-0-path-0-forward-auth"},
|
||||||
Service: "default-whoami-80",
|
Service: "default-ingress-with-forwardauth-whoami-80",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Middlewares: map[string]*dynamic.Middleware{
|
Middlewares: map[string]*dynamic.Middleware{
|
||||||
@ -131,7 +131,7 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Services: map[string]*dynamic.Service{
|
Services: map[string]*dynamic.Service{
|
||||||
"default-whoami-80": {
|
"default-ingress-with-forwardauth-whoami-80": {
|
||||||
LoadBalancer: &dynamic.ServersLoadBalancer{
|
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||||
Servers: []dynamic.Server{
|
Servers: []dynamic.Server{
|
||||||
{
|
{
|
||||||
@ -173,7 +173,7 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
Rule: "Host(`sslredirect.localhost`) && Path(`/`)",
|
Rule: "Host(`sslredirect.localhost`) && Path(`/`)",
|
||||||
RuleSyntax: "default",
|
RuleSyntax: "default",
|
||||||
TLS: &dynamic.RouterTLSConfig{},
|
TLS: &dynamic.RouterTLSConfig{},
|
||||||
Service: "default-whoami-80",
|
Service: "default-ingress-with-ssl-redirect-whoami-80",
|
||||||
},
|
},
|
||||||
"default-ingress-with-ssl-redirect-rule-0-path-0-redirect": {
|
"default-ingress-with-ssl-redirect-rule-0-path-0-redirect": {
|
||||||
Rule: "Host(`sslredirect.localhost`) && Path(`/`)",
|
Rule: "Host(`sslredirect.localhost`) && Path(`/`)",
|
||||||
@ -184,18 +184,18 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
"default-ingress-without-ssl-redirect-rule-0-path-0-http": {
|
"default-ingress-without-ssl-redirect-rule-0-path-0-http": {
|
||||||
Rule: "Host(`withoutsslredirect.localhost`) && Path(`/`)",
|
Rule: "Host(`withoutsslredirect.localhost`) && Path(`/`)",
|
||||||
RuleSyntax: "default",
|
RuleSyntax: "default",
|
||||||
Service: "default-whoami-80",
|
Service: "default-ingress-without-ssl-redirect-whoami-80",
|
||||||
},
|
},
|
||||||
"default-ingress-without-ssl-redirect-rule-0-path-0": {
|
"default-ingress-without-ssl-redirect-rule-0-path-0": {
|
||||||
Rule: "Host(`withoutsslredirect.localhost`) && Path(`/`)",
|
Rule: "Host(`withoutsslredirect.localhost`) && Path(`/`)",
|
||||||
RuleSyntax: "default",
|
RuleSyntax: "default",
|
||||||
TLS: &dynamic.RouterTLSConfig{},
|
TLS: &dynamic.RouterTLSConfig{},
|
||||||
Service: "default-whoami-80",
|
Service: "default-ingress-without-ssl-redirect-whoami-80",
|
||||||
},
|
},
|
||||||
"default-ingress-with-force-ssl-redirect-rule-0-path-0": {
|
"default-ingress-with-force-ssl-redirect-rule-0-path-0": {
|
||||||
Rule: "Host(`forcesslredirect.localhost`) && Path(`/`)",
|
Rule: "Host(`forcesslredirect.localhost`) && Path(`/`)",
|
||||||
RuleSyntax: "default",
|
RuleSyntax: "default",
|
||||||
Service: "default-whoami-80",
|
Service: "default-ingress-with-force-ssl-redirect-whoami-80",
|
||||||
},
|
},
|
||||||
"default-ingress-with-force-ssl-redirect-rule-0-path-0-redirect": {
|
"default-ingress-with-force-ssl-redirect-rule-0-path-0-redirect": {
|
||||||
Rule: "Host(`forcesslredirect.localhost`) && Path(`/`)",
|
Rule: "Host(`forcesslredirect.localhost`) && Path(`/`)",
|
||||||
@ -219,7 +219,41 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Services: map[string]*dynamic.Service{
|
Services: map[string]*dynamic.Service{
|
||||||
"default-whoami-80": {
|
"default-ingress-with-ssl-redirect-whoami-80": {
|
||||||
|
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||||
|
Servers: []dynamic.Server{
|
||||||
|
{
|
||||||
|
URL: "http://10.10.0.1:80",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
URL: "http://10.10.0.2:80",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Strategy: "wrr",
|
||||||
|
PassHostHeader: ptr.To(true),
|
||||||
|
ResponseForwarding: &dynamic.ResponseForwarding{
|
||||||
|
FlushInterval: dynamic.DefaultFlushInterval,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"default-ingress-without-ssl-redirect-whoami-80": {
|
||||||
|
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||||
|
Servers: []dynamic.Server{
|
||||||
|
{
|
||||||
|
URL: "http://10.10.0.1:80",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
URL: "http://10.10.0.2:80",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Strategy: "wrr",
|
||||||
|
PassHostHeader: ptr.To(true),
|
||||||
|
ResponseForwarding: &dynamic.ResponseForwarding{
|
||||||
|
FlushInterval: dynamic.DefaultFlushInterval,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"default-ingress-with-force-ssl-redirect-whoami-80": {
|
||||||
LoadBalancer: &dynamic.ServersLoadBalancer{
|
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||||
Servers: []dynamic.Server{
|
Servers: []dynamic.Server{
|
||||||
{
|
{
|
||||||
@ -313,12 +347,12 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
"default-ingress-with-sticky-rule-0-path-0": {
|
"default-ingress-with-sticky-rule-0-path-0": {
|
||||||
Rule: "Host(`sticky.localhost`) && Path(`/`)",
|
Rule: "Host(`sticky.localhost`) && Path(`/`)",
|
||||||
RuleSyntax: "default",
|
RuleSyntax: "default",
|
||||||
Service: "default-whoami-80",
|
Service: "default-ingress-with-sticky-whoami-80",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Middlewares: map[string]*dynamic.Middleware{},
|
Middlewares: map[string]*dynamic.Middleware{},
|
||||||
Services: map[string]*dynamic.Service{
|
Services: map[string]*dynamic.Service{
|
||||||
"default-whoami-80": {
|
"default-ingress-with-sticky-whoami-80": {
|
||||||
LoadBalancer: &dynamic.ServersLoadBalancer{
|
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||||
Servers: []dynamic.Server{
|
Servers: []dynamic.Server{
|
||||||
{
|
{
|
||||||
@ -370,12 +404,12 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
"default-ingress-with-proxy-ssl-rule-0-path-0": {
|
"default-ingress-with-proxy-ssl-rule-0-path-0": {
|
||||||
Rule: "Host(`proxy-ssl.localhost`) && Path(`/`)",
|
Rule: "Host(`proxy-ssl.localhost`) && Path(`/`)",
|
||||||
RuleSyntax: "default",
|
RuleSyntax: "default",
|
||||||
Service: "default-whoami-tls-443",
|
Service: "default-ingress-with-proxy-ssl-whoami-tls-443",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Middlewares: map[string]*dynamic.Middleware{},
|
Middlewares: map[string]*dynamic.Middleware{},
|
||||||
Services: map[string]*dynamic.Service{
|
Services: map[string]*dynamic.Service{
|
||||||
"default-whoami-tls-443": {
|
"default-ingress-with-proxy-ssl-whoami-tls-443": {
|
||||||
LoadBalancer: &dynamic.ServersLoadBalancer{
|
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||||
Servers: []dynamic.Server{
|
Servers: []dynamic.Server{
|
||||||
{
|
{
|
||||||
@ -423,7 +457,7 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
Rule: "Host(`cors.localhost`) && Path(`/`)",
|
Rule: "Host(`cors.localhost`) && Path(`/`)",
|
||||||
RuleSyntax: "default",
|
RuleSyntax: "default",
|
||||||
Middlewares: []string{"default-ingress-with-cors-rule-0-path-0-cors"},
|
Middlewares: []string{"default-ingress-with-cors-rule-0-path-0-cors"},
|
||||||
Service: "default-whoami-80",
|
Service: "default-ingress-with-cors-whoami-80",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Middlewares: map[string]*dynamic.Middleware{
|
Middlewares: map[string]*dynamic.Middleware{
|
||||||
@ -439,7 +473,7 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Services: map[string]*dynamic.Service{
|
Services: map[string]*dynamic.Service{
|
||||||
"default-whoami-80": {
|
"default-ingress-with-cors-whoami-80": {
|
||||||
LoadBalancer: &dynamic.ServersLoadBalancer{
|
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||||
Servers: []dynamic.Server{
|
Servers: []dynamic.Server{
|
||||||
{
|
{
|
||||||
@ -479,12 +513,12 @@ func TestLoadIngresses(t *testing.T) {
|
|||||||
"default-ingress-with-service-upstream-rule-0-path-0": {
|
"default-ingress-with-service-upstream-rule-0-path-0": {
|
||||||
Rule: "Host(`service-upstream.localhost`) && Path(`/`)",
|
Rule: "Host(`service-upstream.localhost`) && Path(`/`)",
|
||||||
RuleSyntax: "default",
|
RuleSyntax: "default",
|
||||||
Service: "default-whoami-80",
|
Service: "default-ingress-with-service-upstream-whoami-80",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Middlewares: map[string]*dynamic.Middleware{},
|
Middlewares: map[string]*dynamic.Middleware{},
|
||||||
Services: map[string]*dynamic.Service{
|
Services: map[string]*dynamic.Service{
|
||||||
"default-whoami-80": {
|
"default-ingress-with-service-upstream-whoami-80": {
|
||||||
LoadBalancer: &dynamic.ServersLoadBalancer{
|
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||||
Servers: []dynamic.Server{
|
Servers: []dynamic.Server{
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user