the sample ingress spec error

This commit is contained in:
Hui Chen 2018-10-19 11:44:45 +08:00
parent 85424d4af3
commit 32b95be1bb

View file

@ -12,11 +12,11 @@ kind: Ingress
metadata: metadata:
name: test-ingress name: test-ingress
annotations: annotations:
nginx.ingress.kubernetes.io/use-regex: true nginx.ingress.kubernetes.io/use-regex: "true"
spec: spec:
host: test.com
rules: rules:
- http: - host: test.com
http:
paths: paths:
- path: /foo/.* - path: /foo/.*
backend: backend:
@ -27,7 +27,7 @@ spec:
The preceding ingress definition would translate to the following location block within the NGINX configuration for the `test.com` server: The preceding ingress definition would translate to the following location block within the NGINX configuration for the `test.com` server:
```txt ```txt
location ~* ^/foo/.* { location ~* "^/foo/.*" {
... ...
} }
``` ```
@ -48,9 +48,9 @@ kind: Ingress
metadata: metadata:
name: test-ingress-1 name: test-ingress-1
spec: spec:
host: test.com
rules: rules:
- http: - host: test.com
http:
paths: paths:
- path: /foo/bar - path: /foo/bar
backend: backend:
@ -70,9 +70,9 @@ metadata:
annotations: annotations:
nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/rewrite-target: /
spec: spec:
host: test.com
rules: rules:
- http: - host: test.com
http:
paths: paths:
- path: /foo/bar/.+ - path: /foo/bar/.+
backend: backend:
@ -83,24 +83,24 @@ spec:
The ingress controller would define the following location blocks, in order of descending length, within the NGINX template for the `test.com` server: The ingress controller would define the following location blocks, in order of descending length, within the NGINX template for the `test.com` server:
```txt ```txt
location ~* ^/foo/bar/.+\/?(?<baseuri>.*) { location ~* "^/foo/bar/.+\/?(?<baseuri>.*)" {
... ...
} }
location ~* ^/foo/bar/ { location ~* "^/foo/bar/" {
... ...
} }
location ~* ^/foo/bar { location ~* "^/foo/bar" {
... ...
} }
``` ```
The following request URI's would match the corresponding location blocks: The following request URI's would match the corresponding location blocks:
- `test.com/foo/bar/1` matches `~* ^/foo/bar/.+\/?(?<baseuri>.*)` - `test.com/foo/bar/1` matches `~* "^/foo/bar/.+\/?(?<baseuri>.*)"`
- `test.com/foo/bar/` matches `~* ^/foo/bar/` - `test.com/foo/bar/` matches `~* "^/foo/bar/"`
- `test.com/foo/bar` matches `~* ^/foo/bar` - `test.com/foo/bar` matches `~* "^/foo/bar"`
**IMPORTANT NOTES**: **IMPORTANT NOTES**:
@ -121,13 +121,13 @@ Let the following ingress be defined:
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: test-ingress-1 name: test-ingress-3
annotations: annotations:
nginx.ingress.kubernetes.io/use-regex: true nginx.ingress.kubernetes.io/use-regex: "true"
spec: spec:
host: test.com
rules: rules:
- http: - host: test.com
http:
paths: paths:
- path: /foo/bar/bar - path: /foo/bar/bar
backend: backend:
@ -142,11 +142,11 @@ spec:
The ingress controller would define the following location blocks (in this order) within the NGINX template for the `test.com` server: The ingress controller would define the following location blocks (in this order) within the NGINX template for the `test.com` server:
```txt ```txt
location ~* ^/foo/bar/[A-Z0-9]{3} { location ~* "^/foo/bar/[A-Z0-9]{3}" {
... ...
} }
location ~* ^/foo/bar/bar { location ~* "^/foo/bar/bar" {
... ...
} }
``` ```