Skip to content

Commit 58fe81a

Browse files
author
Tamás Hódi
committed
refactor(istio): routerule
1 parent 410c36a commit 58fe81a

File tree

15 files changed

+74
-51
lines changed

15 files changed

+74
-51
lines changed

istio_examples/RouteRule/api/apiDeploymentV1.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

istio_examples/RouteRule/api/apiDeploymentV2.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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"
25+
---
26+
apiVersion: apps/v1beta1
27+
kind: Deployment
28+
metadata:
29+
name: api-v2
30+
labels:
31+
app: api
32+
version: v2
33+
spec:
34+
replicas: 1
35+
template:
36+
metadata:
37+
labels:
38+
app: api
39+
version: v2
40+
name: api-v2
41+
spec:
42+
containers:
43+
- name: api
44+
image: k8s/api:v1
45+
ports:
46+
- containerPort: 5000
47+
env:
48+
- name: VERSION
49+
value: "v2"
File renamed without changes.

istio_examples/RouteRule/api/service.yaml renamed to istio_examples/RouteRule/api/service.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ spec:
99
ports:
1010
- protocol: TCP
1111
port: 5000
12-
nodePort: 30010

istio_examples/RouteRule/api/src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "server.js",
66
"scripts": {
77
"start": "docker run -p 5000:5000 k8s/api:v1",
8-
"build": "docker build -t k8s/api:v1 ."
8+
"dockerize": "docker build -t k8s/api:v1 ."
99
},
1010
"author": "",
1111
"license": "ISC",

istio_examples/RouteRule/deploy.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
DIR=$(pwd)
4+
5+
SERVICE_NAMES=("ui" "api")
6+
7+
for SERVICE_NAME in "${SERVICE_NAMES[@]}"; do
8+
cd $DIR/$SERVICE_NAME/src && npm i && npm run dockerize
9+
kubectl delete service,deployment $SERVICE_NAME
10+
kubectl create -f ../deployment.yml
11+
kubectl create -f ../service.yml
12+
done
13+
14+
API_URL=$(minikube service api --url)
15+
kubectl patch deployment ui --patch '{"spec": {"template": {"spec": {"containers": [{"name": "ui", "env":[{"name": "REACT_APP_API_URL", "value": "'$API_URL'"}]}]}}}}'
16+
17+
kubectl create -f api/routerule.yml

istio_examples/RouteRule/ui/deployment.yaml renamed to istio_examples/RouteRule/ui/deployment.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ spec:
1919
image: k8s/ui:v1
2020
ports:
2121
- containerPort: 3000
22+
env:
23+
- name: REACT_APP_API_URL
24+
value: 'sample-url'
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)