Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rule syntax version for all internal routers #10689

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions integration/testdata/rawdata-consul.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806,
"status": "enabled",
"using": [
Expand All @@ -69,6 +70,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805,
"status": "enabled",
"using": [
Expand Down
2 changes: 2 additions & 0 deletions integration/testdata/rawdata-etcd.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806,
"status": "enabled",
"using": [
Expand All @@ -69,6 +70,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805,
"status": "enabled",
"using": [
Expand Down
2 changes: 2 additions & 0 deletions integration/testdata/rawdata-gateway.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806,
"status": "enabled",
"using": [
Expand All @@ -22,6 +23,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805,
"status": "enabled",
"using": [
Expand Down
2 changes: 2 additions & 0 deletions integration/testdata/rawdata-ingress-label-selector.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806,
"status": "enabled",
"using": [
Expand All @@ -22,6 +23,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805,
"status": "enabled",
"using": [
Expand Down
2 changes: 2 additions & 0 deletions integration/testdata/rawdata-ingress.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806,
"status": "enabled",
"using": [
Expand All @@ -22,6 +23,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805,
"status": "enabled",
"using": [
Expand Down
2 changes: 2 additions & 0 deletions integration/testdata/rawdata-ingressclass-disabled.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806,
"status": "enabled",
"using": [
Expand All @@ -22,6 +23,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805,
"status": "enabled",
"using": [
Expand Down
2 changes: 2 additions & 0 deletions integration/testdata/rawdata-ingressclass.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806,
"status": "enabled",
"using": [
Expand All @@ -22,6 +23,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805,
"status": "enabled",
"using": [
Expand Down
2 changes: 2 additions & 0 deletions integration/testdata/rawdata-redis.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806,
"status": "enabled",
"using": [
Expand All @@ -69,6 +70,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805,
"status": "enabled",
"using": [
Expand Down
2 changes: 2 additions & 0 deletions integration/testdata/rawdata-zk.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806,
"status": "enabled",
"using": [
Expand All @@ -69,6 +70,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805,
"status": "enabled",
"using": [
Expand Down
7 changes: 4 additions & 3 deletions pkg/provider/kubernetes/ingress/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,10 @@ func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Cl
}

rt := &dynamic.Router{
Rule: "PathPrefix(`/`)",
Priority: math.MinInt32,
Service: "default-backend",
Rule: "PathPrefix(`/`)",
RuleSyntax: "v3",
Priority: math.MinInt32,
Service: "default-backend",
}

if rtConfig != nil && rtConfig.Router != nil {
Expand Down
21 changes: 12 additions & 9 deletions pkg/provider/kubernetes/ingress/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,10 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Middlewares: map[string]*dynamic.Middleware{},
Routers: map[string]*dynamic.Router{
"default-router": {
Rule: "PathPrefix(`/`)",
Service: "default-backend",
Priority: math.MinInt32,
Rule: "PathPrefix(`/`)",
RuleSyntax: "v3",
Service: "default-backend",
Priority: math.MinInt32,
},
},
Services: map[string]*dynamic.Service{
Expand Down Expand Up @@ -993,9 +994,10 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Middlewares: map[string]*dynamic.Middleware{},
Routers: map[string]*dynamic.Router{
"default-router": {
Rule: "PathPrefix(`/`)",
Service: "default-backend",
Priority: math.MinInt32,
Rule: "PathPrefix(`/`)",
RuleSyntax: "v3",
Service: "default-backend",
Priority: math.MinInt32,
},
},
Services: map[string]*dynamic.Service{
Expand Down Expand Up @@ -1469,9 +1471,10 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Middlewares: map[string]*dynamic.Middleware{},
Routers: map[string]*dynamic.Router{
"default-router": {
Rule: "PathPrefix(`/`)",
Priority: math.MinInt32,
Service: "default-backend",
Rule: "PathPrefix(`/`)",
RuleSyntax: "v3",
Priority: math.MinInt32,
Service: "default-backend",
},
},
Services: map[string]*dynamic.Service{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806
},
"dashboard": {
Expand All @@ -19,6 +20,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806
}
},
Expand Down
6 changes: 6 additions & 0 deletions pkg/provider/traefik/fixtures/full_configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806
},
"dashboard": {
Expand All @@ -19,6 +20,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"ruleSyntax": "v3",
"priority": 9223372036854775805
},
"debug": {
Expand All @@ -27,6 +29,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/debug`)",
"ruleSyntax": "v3",
"priority": 9223372036854775806
},
"ping": {
Expand All @@ -35,6 +38,7 @@
],
"service": "ping@internal",
"rule": "PathPrefix(`/ping`)",
"ruleSyntax": "v3",
"priority": 9223372036854775807
},
"prometheus": {
Expand All @@ -43,6 +47,7 @@
],
"service": "prometheus@internal",
"rule": "PathPrefix(`/metrics`)",
"ruleSyntax": "v3",
"priority": 9223372036854775807
},
"rest": {
Expand All @@ -51,6 +56,7 @@
],
"service": "rest@internal",
"rule": "PathPrefix(`/api/providers`)",
"ruleSyntax": "v3",
"priority": 9223372036854775807
}
},
Expand Down
1 change: 1 addition & 0 deletions pkg/provider/traefik/fixtures/ping_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"service": "ping@internal",
"rule": "PathPrefix(`/ping`)",
"ruleSyntax": "v3",
"priority": 9223372036854775807
}
},
Expand Down
1 change: 1 addition & 0 deletions pkg/provider/traefik/fixtures/prometheus_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"service": "prometheus@internal",
"rule": "PathPrefix(`/metrics`)",
"ruleSyntax": "v3",
"priority": 9223372036854775807
}
},
Expand Down
3 changes: 2 additions & 1 deletion pkg/provider/traefik/fixtures/redirection.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"redirect-web-to-websecure"
],
"service": "noop@internal",
"rule": "HostRegexp(`^.+$`)"
"rule": "HostRegexp(`^.+$`)",
"ruleSyntax": "v3"
}
},
"services": {
Expand Down
3 changes: 2 additions & 1 deletion pkg/provider/traefik/fixtures/redirection_port.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"redirect-web-to-443"
],
"service": "noop@internal",
"rule": "HostRegexp(`^.+$`)"
"rule": "HostRegexp(`^.+$`)",
"ruleSyntax": "v3"
}
},
"services": {
Expand Down
3 changes: 2 additions & 1 deletion pkg/provider/traefik/fixtures/redirection_with_protocol.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"redirect-web-to-websecure"
],
"service": "noop@internal",
"rule": "HostRegexp(`^.+$`)"
"rule": "HostRegexp(`^.+$`)",
"ruleSyntax": "v3"
}
},
"services": {
Expand Down
1 change: 1 addition & 0 deletions pkg/provider/traefik/fixtures/rest_insecure.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"service": "rest@internal",
"rule": "PathPrefix(`/api/providers`)",
"ruleSyntax": "v3",
"priority": 9223372036854775807
}
},
Expand Down
8 changes: 8 additions & 0 deletions pkg/provider/traefik/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func (i *Provider) acme(cfg *dynamic.Configuration) {
if len(eps) > 0 {
rt := &dynamic.Router{
Rule: "PathPrefix(`/.well-known/acme-challenge/`)",
RuleSyntax: "v3",
EntryPoints: eps,
Service: "acme-http@internal",
Priority: math.MaxInt,
Expand Down Expand Up @@ -141,6 +142,7 @@ func (i *Provider) redirection(ctx context.Context, cfg *dynamic.Configuration)

rt := &dynamic.Router{
Rule: "HostRegexp(`^.+$`)",
RuleSyntax: "v3",
EntryPoints: []string{name},
Middlewares: []string{mdName},
Service: "noop@internal",
Expand Down Expand Up @@ -241,6 +243,7 @@ func (i *Provider) apiConfiguration(cfg *dynamic.Configuration) {
Service: "api@internal",
Priority: math.MaxInt - 1,
Rule: "PathPrefix(`/api`)",
RuleSyntax: "v3",
}

if i.staticCfg.API.Dashboard {
Expand All @@ -249,6 +252,7 @@ func (i *Provider) apiConfiguration(cfg *dynamic.Configuration) {
Service: "dashboard@internal",
Priority: math.MaxInt - 2,
Rule: "PathPrefix(`/`)",
RuleSyntax: "v3",
Middlewares: []string{"dashboard_redirect@internal", "dashboard_stripprefix@internal"},
}

Expand All @@ -270,6 +274,7 @@ func (i *Provider) apiConfiguration(cfg *dynamic.Configuration) {
Service: "api@internal",
Priority: math.MaxInt - 1,
Rule: "PathPrefix(`/debug`)",
RuleSyntax: "v3",
}
}
}
Expand All @@ -292,6 +297,7 @@ func (i *Provider) pingConfiguration(cfg *dynamic.Configuration) {
Service: "ping@internal",
Priority: math.MaxInt,
Rule: "PathPrefix(`/ping`)",
RuleSyntax: "v3",
}
}

Expand All @@ -309,6 +315,7 @@ func (i *Provider) restConfiguration(cfg *dynamic.Configuration) {
Service: "rest@internal",
Priority: math.MaxInt,
Rule: "PathPrefix(`/api/providers`)",
RuleSyntax: "v3",
}
}

Expand All @@ -326,6 +333,7 @@ func (i *Provider) prometheusConfiguration(cfg *dynamic.Configuration) {
Service: "prometheus@internal",
Priority: math.MaxInt,
Rule: "PathPrefix(`/metrics`)",
RuleSyntax: "v3",
}
}

Expand Down
Loading