-
Notifications
You must be signed in to change notification settings - Fork 0
/
ingress.yml
54 lines (51 loc) · 1.33 KB
/
ingress.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: nginx-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/configuration-snippet: |
internal;
rewrite ^ $original_uri break;
nginx.ingress.kubernetes.io/server-snippet: |
location /api/books {
if ( $request_method = GET) {
set $target_destination '/_get';
}
if ( $request_method = POST) {
set $target_destination '/_post';
}
if ( $request_method = PUT) {
set $target_destination '/_put';
}
if ( $request_method = DELETE) {
set $target_destination '/_delete';
}
set $original_uri $uri;
rewrite ^ $target_destination last;
}
spec:
rules:
- host: myservice.foo.org
http:
paths:
- path: /
backend:
serviceName: frontend-service
servicePort: 80
- path: /_get
backend:
serviceName: get-service
servicePort: 8080
- path: /_post
backend:
serviceName: post-service
servicePort: 8080
- path: /_put
backend:
serviceName: put-service
servicePort: 8080
- path: /_delete
backend:
serviceName: delete-service
servicePort: 8080