-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add add route feature into client #65
Conversation
8b8c937
to
d0ce2db
Compare
Codecov Report
@@ Coverage Diff @@
## master #65 +/- ##
=======================================
Coverage 87.68% 87.68%
=======================================
Files 7 7
Lines 203 203
=======================================
Hits 178 178
Misses 16 16
Partials 9 9 Continue to review full report at Codecov.
|
d0ce2db
to
d5e0c74
Compare
As https://godoc.org/github.com/jessevdk/go-flags#hdr-Available_field_tags said, the short name of the option should be single character. So, I remove short option of route net. |
d5e0c74
to
684b0d1
Compare
05d7fb9
to
c28fb78
Compare
22b127c
to
380809f
Compare
Fix README. |
380809f
to
1504b88
Compare
- Add table of contents - Add add route description & udpate client options description
1504b88
to
d360654
Compare
Test result $ kubectl get po
NAME READY STATUS RESTARTS AGE
myapp-pod 1/1 Running 0 3m
network-controller-server-tcp-695ch 1/1 Running 0 7m
network-controller-server-unix-qh52w 1/1 Running 0 6m
$ kubectl exec -it myapp-pod -- bash
root@myapp-pod:/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.244.0.1 0.0.0.0 UG 0 0 0 eth0
10.244.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.244.0.0 10.244.0.1 255.255.0.0 UG 0 0 0 eth0
192.168.24.0 0.0.0.0 255.255.255.0 U 0 0 0 eth100
224.0.0.0 0.0.0.0 240.0.0.0 U 0 0 0 eth100
piVersion: v1
kind: Pod
metadata:
name: myapp-pod
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: ubuntu
command: ['sh', '-c', 'echo The app is running! && sleep 3600']
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:sufuf3_add-route-options
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br100", "-n=eth100", "-i=192.168.24.50/24", "--net=224.0.0.0/4", "-g=0.0.0.0"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
restartPolicy: Never
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/ |
@sufuf3 可以幫我測試一個gw 不是0.0.0.0的嗎 |
Here you go. Can be run, too. $ kubectl get po
NAME READY STATUS RESTARTS AGE
myapp-pod 1/1 Running 0 19m
myapp-pod2 1/1 Running 0 1m
network-controller-server-tcp-695ch 1/1 Running 0 23m
network-controller-server-unix-qh52w 1/1 Running 0 23m
$ kubectl exec -it myapp-pod2 -- bash
root@myapp-pod2:/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.244.0.1 0.0.0.0 UG 0 0 0 eth0
10.244.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.244.0.0 10.244.0.1 255.255.0.0 UG 0 0 0 eth0
192.168.24.0 0.0.0.0 255.255.255.0 U 0 0 0 eth100
224.0.0.0 0.0.0.0 240.0.0.0 U 0 0 0 eth100
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod2
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: ubuntu
command: ['sh', '-c', 'echo The app is running! && sleep 3600']
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:sufuf3_add-route-options
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br100", "-n=eth100", "-i=192.168.24.51/24", "--net=224.0.0.0/4"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
restartPolicy: Never
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/ |
哦 我意思是 gw 可能是1.2.3.4或其他的IP |
GW 0.0.0.0 表示該路由是直接由 local 傳送,所以 pod 可以被 Create 起來
$ sudo ovs-vsctl show
69f80869-0ecf-400d-858b-e35ed18aa96d
Bridge "br100"
Port "vethee3eeacf"
Interface "vethee3eeacf"
Port "br100"
Interface "br100"
type: internal
Port "veth2bb82b62"
Interface "veth2bb82b62"
ovs_version: "2.9.2"
$ kubectl get po -w
NAME READY STATUS RESTARTS AGE
myapp-pod 1/1 Running 0 30m
myapp-pod2 1/1 Running 0 12m
myapp-pod3 0/1 Init:Error 0 4s
network-controller-server-tcp-695ch 1/1 Running 0 34m
network-controller-server-unix-qh52w 1/1 Running 0 34m
$ kubectl logs myapp-pod3 -c init-network-client
2018/07/24 09:29:26 Start to connect to unix:///tmp/vortex.sock
2018/07/24 09:29:26 myapp-pod3 default 0e64f03b-8f24-11e8-8312-0240c1fa9bf5
2018/07/24 09:29:26 Try to find the network namespace path
2018/07/24 09:29:26 Find network namesace path is sussessful.
2018/07/24 09:29:26 The path is /var/run/docker/netns/d01a08684009.
2018/07/24 09:29:26 Try to connect bridge /var/run/docker/netns/d01a08684009 eth100 br100
2018/07/24 09:29:26 Connect bridge is sussessful.
2018/07/24 09:29:26 Configure interface is sussessful.
2018/07/24 09:29:26 There is something wrong with adding route: rpc error: code = Unknown desc = network is unreachable
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod3
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: ubuntu
command: ['sh', '-c', 'echo The app is running! && sleep 3600']
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:sufuf3_add-route-options
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br100", "-n=eth100", "-i=192.168.24.53/24", "--net=224.0.0.0/4", "-g=10.244.0.1"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
restartPolicy: Never
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/ |
ok 了解! |
cc linkernetworks/vortex#154