Skip to content

Commit

Permalink
[Microservices] Route manager (futurewei-cloud#144)
Browse files Browse the repository at this point in the history
The Route Manager could store routing tables/rules for vpc, subnet, and gateway. It will interact with vpc manager, subnet manager, and gateway manager.

* New APIs: Add get/create apis on route manager and interaction with vpc manager

* Schema update: Add web route schema and update vpc schema

* Service codes: new route manager server codes

* Code structure: package path update for common lib, vpc manager

* Deployment: Update docker and pom files

* Deployment: Remove lib jar and add dependency on pom for route manager

* Deployment: Update dynamically load configuration file in kubernetes

Co-authored-by: Kevin <[email protected]>
  • Loading branch information
Liguang Xie and kevin-zhonghao authored Apr 3, 2020
1 parent 13efc56 commit 0e92f99
Show file tree
Hide file tree
Showing 66 changed files with 2,093 additions and 56 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ fabric.properties
# Vpcmanager files
vpcmanager/target/
lib/target/

### Logs ###
*.log
*.gz
6 changes: 4 additions & 2 deletions kubernetes/services/api-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ spec:
selector:
matchLabels:
app: apimanager
replicas: 1
replicas: 2
#replicas: 3
template:
metadata:
labels:
app: apimanager
spec:
containers:
- image: zhonghaolyu/repo:apiKube4
- image: fwnetworking/controller:api_gateway-v0.3.0
#- image: zhonghaolyu/repo:apiKube6
name: apimanager-web
imagePullPolicy: IfNotPresent
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ spec:
app: redis
spec:
containers:
- image: redis
#- image: redis
- image: fwnetworking/controller:redis
name: redis
imagePullPolicy: IfNotPresent
ports:
Expand Down
36 changes: 36 additions & 0 deletions kubernetes/services/redis_route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v1
kind: Service
metadata:
name: redis-route-sr
labels:
name: redis-route
spec:
ports:
- port: 6380
targetPort: 6379
selector:
app: redis-route
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: redis-route
name: redis-route
spec:
selector:
matchLabels:
app: redis-route
replicas: 1
template:
metadata:
labels:
app: redis-route
spec:
containers:
#- image: redis
- image: fwnetworking/controller:redis
name: redis-route
imagePullPolicy: IfNotPresent
ports:
- containerPort: 6379
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,37 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: vpcmanager
name: vpcmanager
app: routemanager
name: routemanager
spec:
selector:
matchLabels:
app: vpcmanager
app: routemanager
replicas: 1
#replicas: 3
template:
metadata:
labels:
app: vpcmanager
app: routemanager
spec:
containers:
- image: zhonghaolyu/repo:test1
name: vpcmanager-web
#- image: zhonghaolyu/repo:routeKube3
- image: fwnetworking/controller:route_manager-v0.3.0
name: routemanager-web
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: vpcmanager-service
name: routemanager-service
labels:
name: vpcmanager-service
name: routemanager-service
spec:
type: NodePort
ports:
- port: 8080
nodePort: 30002
nodePort: 30003
selector:
app: vpcmanager
app: routemanager
68 changes: 68 additions & 0 deletions kubernetes/services/vpc_manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: vpc-configmap
data:
application.properties: |
spring.redis.host=10.109.127.248
spring.redis.port=6379
logging.level.root=info
logging.level.org.springframework.web=info
logging.file.path=.
logging.type=file
apache.kafka.address=172.17.0.1:9092
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: vpcmanager
name: vpcmanager
spec:
selector:
matchLabels:
app: vpcmanager
replicas: 2
#replicas: 3
template:
metadata:
labels:
app: vpcmanager
spec:
volumes:
- name: vpc-volume
configMap:
name: vpc-configmap
items:
- key: application.properties
path: application.properties
containers:
#- image: zhonghaolyu/repo:vpcKube4
- image: fwnetworking/controller:vpc_manager-v0.3.0
name: vpcmanager-web
imagePullPolicy: IfNotPresent
command: ["java", "-jar", "/app/AlcorVpcManager-0.1.0.jar", "--spring.config.location=/etc/app/application.properties"]
ports:
- containerPort: 8080
volumeMounts:
- name: vpc-volume
mountPath: /etc/app
envFrom:
- configMapRef:
name: vpc-configmap
---
apiVersion: v1
kind: Service
metadata:
name: vpcmanager-service
labels:
name: vpcmanager-service
spec:
type: NodePort
ports:
- port: 8001
targetPort: 8080
nodePort: 30001
selector:
app: vpcmanager

Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ public ResourceNotFoundException(String message, Throwable cause) {
public ResourceNotFoundException(Throwable cause) {
super(cause);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
@ConfigurationProperties(prefix = "vpc.destinations")
public class VpcWebDestinations {

private String defaultServiceUrl = "http://192.168.1.17:30001";
private String defaultServiceUrl = "http://192.168.1.17:30001"; // Kubernetes
//private String defaultServiceUrl = "http://192.168.137.1:8080"; // DOcker

@NotNull
private String vpcManagerServiceUrl;
Expand Down
35 changes: 35 additions & 0 deletions services/route_manager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/

### Logs ###
*.log
*.gz
File renamed without changes.
16 changes: 16 additions & 0 deletions services/route_manager/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Dockerfile for VPC Manager

FROM openjdk:8

MAINTAINER Zhonghao Lyu <[email protected]>

# Route Manager process
EXPOSE 8080
# ROute Manager admin process

# Generate container image and run container
COPY ./target/AlcorRouteManager-0.1.0-SNAPSHOT.jar /app/AlcorRouteManager-0.1.0.jar
#COPY ./config/machine.json /app/config/machine.json

CMD ["java", "-jar", "/app/AlcorRouteManager-0.1.0.jar"]

File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0e92f99

Please sign in to comment.