Drop traefik from default entry points.
This commit is contained in:
parent
5adf74e6ce
commit
af58faafae
4 changed files with 10 additions and 12 deletions
|
@ -200,7 +200,7 @@ func setupServer(staticConfiguration *static.Configuration) (*server.Server, err
|
||||||
log.WithoutContext().Errorf("Invalid protocol: %v", err)
|
log.WithoutContext().Errorf("Invalid protocol: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if protocol != "udp" {
|
if protocol != "udp" && name != static.DefaultInternalEntryPointName {
|
||||||
defaultEntryPoints = append(defaultEntryPoints, name)
|
defaultEntryPoints = append(defaultEntryPoints, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
integration/testdata/rawdata-ingress.json
vendored
4
integration/testdata/rawdata-ingress.json
vendored
|
@ -30,20 +30,17 @@
|
||||||
},
|
},
|
||||||
"test-ingress-default-whoami-test-whoami@kubernetes": {
|
"test-ingress-default-whoami-test-whoami@kubernetes": {
|
||||||
"entryPoints": [
|
"entryPoints": [
|
||||||
"traefik",
|
|
||||||
"web"
|
"web"
|
||||||
],
|
],
|
||||||
"service": "default-whoami-http",
|
"service": "default-whoami-http",
|
||||||
"rule": "Host(`whoami.test`) \u0026\u0026 PathPrefix(`/whoami`)",
|
"rule": "Host(`whoami.test`) \u0026\u0026 PathPrefix(`/whoami`)",
|
||||||
"status": "enabled",
|
"status": "enabled",
|
||||||
"using": [
|
"using": [
|
||||||
"traefik",
|
|
||||||
"web"
|
"web"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"test-ingress-https-default-whoami-test-https-whoami@kubernetes": {
|
"test-ingress-https-default-whoami-test-https-whoami@kubernetes": {
|
||||||
"entryPoints": [
|
"entryPoints": [
|
||||||
"traefik",
|
|
||||||
"web"
|
"web"
|
||||||
],
|
],
|
||||||
"service": "default-whoami-http",
|
"service": "default-whoami-http",
|
||||||
|
@ -51,7 +48,6 @@
|
||||||
"tls": {},
|
"tls": {},
|
||||||
"status": "enabled",
|
"status": "enabled",
|
||||||
"using": [
|
"using": [
|
||||||
"traefik",
|
|
||||||
"web"
|
"web"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,14 +180,14 @@ type Providers struct {
|
||||||
// SetEffectiveConfiguration adds missing configuration parameters derived from existing ones.
|
// SetEffectiveConfiguration adds missing configuration parameters derived from existing ones.
|
||||||
// It also takes care of maintaining backwards compatibility.
|
// It also takes care of maintaining backwards compatibility.
|
||||||
func (c *Configuration) SetEffectiveConfiguration() {
|
func (c *Configuration) SetEffectiveConfiguration() {
|
||||||
|
// Creates the default entry point if needed
|
||||||
if len(c.EntryPoints) == 0 {
|
if len(c.EntryPoints) == 0 {
|
||||||
ep := &EntryPoint{Address: ":80"}
|
ep := &EntryPoint{Address: ":80"}
|
||||||
ep.SetDefaults()
|
ep.SetDefaults()
|
||||||
c.EntryPoints = EntryPoints{
|
c.EntryPoints = EntryPoints{"http": ep}
|
||||||
"http": ep,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Creates the internal traefik entry point if needed
|
||||||
if (c.API != nil && c.API.Insecure) ||
|
if (c.API != nil && c.API.Insecure) ||
|
||||||
(c.Ping != nil && !c.Ping.ManualRouting && c.Ping.EntryPoint == DefaultInternalEntryPointName) ||
|
(c.Ping != nil && !c.Ping.ManualRouting && c.Ping.EntryPoint == DefaultInternalEntryPointName) ||
|
||||||
(c.Metrics != nil && c.Metrics.Prometheus != nil && !c.Metrics.Prometheus.ManualRouting && c.Metrics.Prometheus.EntryPoint == DefaultInternalEntryPointName) ||
|
(c.Metrics != nil && c.Metrics.Prometheus != nil && !c.Metrics.Prometheus.ManualRouting && c.Metrics.Prometheus.EntryPoint == DefaultInternalEntryPointName) ||
|
||||||
|
|
|
@ -14,6 +14,8 @@ import (
|
||||||
"github.com/containous/traefik/v2/pkg/tls"
|
"github.com/containous/traefik/v2/pkg/tls"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const defaultInternalEntryPointName = "traefik"
|
||||||
|
|
||||||
var _ provider.Provider = (*Provider)(nil)
|
var _ provider.Provider = (*Provider)(nil)
|
||||||
|
|
||||||
// Provider is a provider.Provider implementation that provides the internal routers.
|
// Provider is a provider.Provider implementation that provides the internal routers.
|
||||||
|
@ -137,7 +139,7 @@ func (i *Provider) apiConfiguration(cfg *dynamic.Configuration) {
|
||||||
|
|
||||||
if i.staticCfg.API.Insecure {
|
if i.staticCfg.API.Insecure {
|
||||||
cfg.HTTP.Routers["api"] = &dynamic.Router{
|
cfg.HTTP.Routers["api"] = &dynamic.Router{
|
||||||
EntryPoints: []string{"traefik"},
|
EntryPoints: []string{defaultInternalEntryPointName},
|
||||||
Service: "api@internal",
|
Service: "api@internal",
|
||||||
Priority: math.MaxInt32 - 1,
|
Priority: math.MaxInt32 - 1,
|
||||||
Rule: "PathPrefix(`/api`)",
|
Rule: "PathPrefix(`/api`)",
|
||||||
|
@ -145,7 +147,7 @@ func (i *Provider) apiConfiguration(cfg *dynamic.Configuration) {
|
||||||
|
|
||||||
if i.staticCfg.API.Dashboard {
|
if i.staticCfg.API.Dashboard {
|
||||||
cfg.HTTP.Routers["dashboard"] = &dynamic.Router{
|
cfg.HTTP.Routers["dashboard"] = &dynamic.Router{
|
||||||
EntryPoints: []string{"traefik"},
|
EntryPoints: []string{defaultInternalEntryPointName},
|
||||||
Service: "dashboard@internal",
|
Service: "dashboard@internal",
|
||||||
Priority: math.MaxInt32 - 2,
|
Priority: math.MaxInt32 - 2,
|
||||||
Rule: "PathPrefix(`/`)",
|
Rule: "PathPrefix(`/`)",
|
||||||
|
@ -166,7 +168,7 @@ func (i *Provider) apiConfiguration(cfg *dynamic.Configuration) {
|
||||||
|
|
||||||
if i.staticCfg.API.Debug {
|
if i.staticCfg.API.Debug {
|
||||||
cfg.HTTP.Routers["debug"] = &dynamic.Router{
|
cfg.HTTP.Routers["debug"] = &dynamic.Router{
|
||||||
EntryPoints: []string{"traefik"},
|
EntryPoints: []string{defaultInternalEntryPointName},
|
||||||
Service: "api@internal",
|
Service: "api@internal",
|
||||||
Priority: math.MaxInt32 - 1,
|
Priority: math.MaxInt32 - 1,
|
||||||
Rule: "PathPrefix(`/debug`)",
|
Rule: "PathPrefix(`/debug`)",
|
||||||
|
@ -205,7 +207,7 @@ func (i *Provider) restConfiguration(cfg *dynamic.Configuration) {
|
||||||
|
|
||||||
if i.staticCfg.Providers.Rest.Insecure {
|
if i.staticCfg.Providers.Rest.Insecure {
|
||||||
cfg.HTTP.Routers["rest"] = &dynamic.Router{
|
cfg.HTTP.Routers["rest"] = &dynamic.Router{
|
||||||
EntryPoints: []string{"traefik"},
|
EntryPoints: []string{defaultInternalEntryPointName},
|
||||||
Service: "rest@internal",
|
Service: "rest@internal",
|
||||||
Priority: math.MaxInt32,
|
Priority: math.MaxInt32,
|
||||||
Rule: "PathPrefix(`/api/providers`)",
|
Rule: "PathPrefix(`/api/providers`)",
|
||||||
|
|
Loading…
Reference in a new issue