Make the behavior of prefix matching in Ingress consistent with Kubernetes doc
This commit is contained in:
parent
8c6ed23c5f
commit
4790e4910f
10 changed files with 262 additions and 2 deletions
|
|
@ -529,6 +529,29 @@ providers:
|
|||
--providers.kubernetesingress.nativeLBByDefault=true
|
||||
```
|
||||
|
||||
### `strictPrefixMatching`
|
||||
|
||||
_Optional, Default: false_
|
||||
|
||||
Make prefix matching strictly comply with the Kubernetes Ingress specification (path-element-wise matching instead of character-by-character string matching). For example, a PathPrefix of `/foo` will match `/foo`, `/foo/`, and `/foo/bar` but not `/foobar`.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
providers:
|
||||
kubernetesIngress:
|
||||
strictPrefixMatching: true
|
||||
# ...
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[providers.kubernetesIngress]
|
||||
strictPrefixMatching = true
|
||||
# ...
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--providers.kubernetesingress.strictPrefixMatching=true
|
||||
```
|
||||
|
||||
### Further
|
||||
|
||||
To learn more about the various aspects of the Ingress specification that Traefik supports,
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ which in turn creates the resulting routers, services, handlers, etc.
|
|||
| `providers.kubernetesIngress.allowExternalNameServices` | Allows the `Ingress` to reference ExternalName services. | false | No |
|
||||
| `providers.kubernetesIngress.nativeLBByDefault` | Allow using the Kubernetes Service load balancing between the pods instead of the one provided by Traefik for every `Ingress` by default.<br />It can br overridden in the [`ServerTransport`](../../../../routing/services/index.md#serverstransport). | false | No |
|
||||
| `providers.kubernetesIngress.disableClusterScopeResources` | Prevent from discovering cluster scope resources (`IngressClass` and `Nodes`).<br />By doing so, it alleviates the requirement of giving Traefik the rights to look up for cluster resources.<br />Furthermore, Traefik will not handle Ingresses with IngressClass references, therefore such Ingresses will be ignored (please note that annotations are not affected by this option).<br />This will also prevent from using the `NodePortLB` options on services. | false | No |
|
||||
| `providers.kubernetesIngress.strictPrefixMatching` | Make prefix matching strictly comply with the Kubernetes Ingress specification (path-element-wise matching instead of character-by-character string matching). For example, a PathPrefix of `/foo` will match `/foo`, `/foo/`, and `/foo/bar` but not `/foobar`. | false | No |
|
||||
|
||||
<!-- markdownlint-enable MD013 -->
|
||||
|
||||
|
|
|
|||
|
|
@ -1032,6 +1032,9 @@ Kubernetes namespaces.
|
|||
`--providers.kubernetesingress.nativelbbydefault`:
|
||||
Defines whether to use Native Kubernetes load-balancing mode by default. (Default: ```false```)
|
||||
|
||||
`--providers.kubernetesingress.strictprefixmatching`:
|
||||
Make prefix matching strictly comply with the Kubernetes Ingress specification (path-element-wise matching instead of character-by-character string matching). (Default: ```false```)
|
||||
|
||||
`--providers.kubernetesingress.throttleduration`:
|
||||
Ingress refresh throttle duration (Default: ```0```)
|
||||
|
||||
|
|
|
|||
|
|
@ -1032,6 +1032,9 @@ Kubernetes namespaces.
|
|||
`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_NATIVELBBYDEFAULT`:
|
||||
Defines whether to use Native Kubernetes load-balancing mode by default. (Default: ```false```)
|
||||
|
||||
`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_STRICTPREFIXMATCHING`:
|
||||
Make prefix matching strictly comply with the Kubernetes Ingress specification (path-element-wise matching instead of character-by-character string matching). (Default: ```false```)
|
||||
|
||||
`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_THROTTLEDURATION`:
|
||||
Ingress refresh throttle duration (Default: ```0```)
|
||||
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@
|
|||
disableIngressClassLookup = true
|
||||
disableClusterScopeResources = true
|
||||
nativeLBByDefault = true
|
||||
strictPrefixMatching = true
|
||||
[providers.kubernetesIngress.ingressEndpoint]
|
||||
ip = "foobar"
|
||||
hostname = "foobar"
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ providers:
|
|||
disableIngressClassLookup: true
|
||||
disableClusterScopeResources: true
|
||||
nativeLBByDefault: true
|
||||
strictPrefixMatching: true
|
||||
kubernetesCRD:
|
||||
endpoint: foobar
|
||||
token: foobar
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ If the Kubernetes cluster version is 1.18+,
|
|||
the new `pathType` property can be leveraged to define the rules matchers:
|
||||
|
||||
- `Exact`: This path type forces the rule matcher to `Path`
|
||||
- `Prefix`: This path type forces the rule matcher to `PathPrefix`
|
||||
- `Prefix`: This path type forces the rule matcher to `PathPrefix`. Note that if you want the matching behavior to strictly comply with Kubernetes Ingress specification (request path is matched on an element-by-element basis), consider enabling [`strictPrefixMatching`](../../providers/kubernetes-ingress.md#strictprefixmatching) in the Ingress Provider configuration.
|
||||
|
||||
Please see [this documentation](https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types) for more information.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue