-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateroutes.yml
73 lines (69 loc) · 2.03 KB
/
updateroutes.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
- name: Apply Kubernetes resource files
hosts: [oraclemaster, azuremaster]
become: yes
tasks:
- name: Create directory for resource files
file:
path: /tmp/routes
state: directory
when: inventory_hostname == control_node
- name: Copy Gateway YAML content
copy:
content: |
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: microservices-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
dest: /tmp/routes/gateway.yaml
when: inventory_hostname == control_node
- name: Copy VirtualService YAML content
copy:
content: |
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: microservices-virtual-service
spec:
hosts:
- "*"
gateways:
- microservices-gateway
http:
- match:
- uri:
prefix: /order-service/
rewrite:
uri: /
route:
- destination:
host: order-service.default.svc.cluster.local
- match:
- uri:
prefix: /payment-service/
rewrite:
uri: /
route:
- destination:
host: payment-service.default.svc.cluster.local
- match:
- uri:
prefix: /
route:
- destination:
host: app1service.default.svc.cluster.local
dest: /tmp/routes/virtual-service.yaml
when: inventory_hostname == control_node
- name: Apply changes to the resource
command: "kubectl apply -f /tmp/routes"
become_user: ubuntu
when: inventory_hostname == control_node