forked from arunksingh16/istio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcanary_ingress.yaml
86 lines (80 loc) · 1.87 KB
/
canary_ingress.yaml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
# the kubernetes deployment YAML for canary deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: flaskfrontend-v2
labels:
app: flaskfrontend
version: v2
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: flaskfrontend
version: v2
template:
metadata:
labels:
app: flaskfrontend
version: v2
spec:
containers:
- name: flaskfrontend
image: "singharunk/flaskfrontend:v2"
imagePullPolicy: "Always"
env:
- name: nspace
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: SERVICE_X
value: "flaskbackend.$(nspace).svc.cluster.local"
- name: SERVICE_X_PORT
value: "6000"
ports:
- containerPort: 5000
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: flaskvirtualservice
spec:
hosts:
- "flask.example.com" # destination hosts to which traffic is being sent. The hosts field applies to both HTTP and TCP services
gateways:
- flask-gateway
http:
- match:
- uri:
prefix: /list
- uri:
prefix: /home
route:
- destination:
host: flaskfrontend.default.svc.cluster.local
subset: v1
port:
number: 5000
weight: 90
- destination:
host: flaskfrontend.default.svc.cluster.local
subset: v2 # default to pods of the flaskfrontend service with label “version: v1” (i.e., subset v1)
port:
number: 5000
weight: 10
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: flaskdestinationrule
spec:
host: flaskfrontend.default.svc.cluster.local
subsets:
- name: v1
labels:
version: v1 # this is latest tag in our image
- name: v2
labels:
version: v2