Skip to content

Commit 399b1b6

Browse files
committed
feat(istio): routerule example added (not working as intended)
1 parent 2324a0e commit 399b1b6

File tree

16 files changed

+11206
-0
lines changed

16 files changed

+11206
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: apps/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: api-v1
5+
labels:
6+
app: api
7+
version: v1
8+
spec:
9+
replicas: 1
10+
template:
11+
metadata:
12+
labels:
13+
app: api
14+
version: v1
15+
name: api-v1
16+
spec:
17+
containers:
18+
- name: api
19+
image: k8s/api:v1
20+
ports:
21+
- containerPort: 5000
22+
env:
23+
- name: VERSION
24+
value: "v1"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: apps/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: api-v2
5+
labels:
6+
app: api
7+
version: v2
8+
spec:
9+
replicas: 1
10+
template:
11+
metadata:
12+
labels:
13+
app: api
14+
version: v2
15+
name: api-v2
16+
spec:
17+
containers:
18+
- name: api
19+
image: k8s/api:v1
20+
ports:
21+
- containerPort: 5000
22+
env:
23+
- name: VERSION
24+
value: "v2"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# every request with Version: v2 header to api service will be sent to "v2" instance
2+
# all remaning will be sent to "v1"
3+
apiVersion: config.istio.io/v1alpha2
4+
kind: RouteRule
5+
metadata:
6+
name: api-v2
7+
spec:
8+
destination:
9+
name: api
10+
precedence: 2
11+
match:
12+
request:
13+
headers:
14+
version: v2
15+
route:
16+
- labels:
17+
version: v2
18+
---
19+
apiVersion: config.istio.io/v1alpha2
20+
kind: RouteRule
21+
metadata:
22+
name: api-default
23+
spec:
24+
destination:
25+
name: api
26+
precedence: 1
27+
route:
28+
- labels:
29+
version: v1
30+
weight: 100
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: api
5+
spec:
6+
selector:
7+
app: api
8+
type: NodePort
9+
ports:
10+
- protocol: TCP
11+
port: 5000
12+
nodePort: 30010
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM node:8.9.4-alpine
2+
3+
ENV PORT 5000
4+
5+
COPY package.json package.json
6+
RUN npm install
7+
8+
COPY . .
9+
10+
CMD ["node", "."]
11+
EXPOSE $PORT

0 commit comments

Comments
 (0)