Skip to content
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

Merged
merged 2 commits into from
Jul 24, 2018
Merged

Conversation

sufuf3
Copy link
Contributor

@sufuf3 sufuf3 commented Jul 24, 2018

@sufuf3 sufuf3 force-pushed the sufuf3/add-route-options branch 3 times, most recently from 8b8c937 to d0ce2db Compare July 24, 2018 07:06
@codecov
Copy link

codecov bot commented Jul 24, 2018

Codecov Report

Merging #65 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6c49005...d360654. Read the comment docs.

@sufuf3
Copy link
Contributor Author

sufuf3 commented Jul 24, 2018

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.
PS. I refer to https://linux.die.net/man/8/route.

@sufuf3 sufuf3 force-pushed the sufuf3/add-route-options branch 3 times, most recently from 05d7fb9 to c28fb78 Compare July 24, 2018 08:03
@sufuf3 sufuf3 force-pushed the sufuf3/add-route-options branch 3 times, most recently from 22b127c to 380809f Compare July 24, 2018 08:28
@sufuf3
Copy link
Contributor Author

sufuf3 commented Jul 24, 2018

Fix README.
Please help me review this PR, thank you.

- Add table of contents
- Add add route description & udpate client options description
@John-Lin John-Lin merged commit cc9131c into master Jul 24, 2018
@sufuf3 sufuf3 deleted the sufuf3/add-route-options branch July 24, 2018 08:42
@sufuf3
Copy link
Contributor Author

sufuf3 commented Jul 24, 2018

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
  • Client.yml
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/

@John-Lin
Copy link
Contributor

@sufuf3 可以幫我測試一個gw 不是0.0.0.0的嗎

@sufuf3
Copy link
Contributor Author

sufuf3 commented Jul 24, 2018

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
  • yaml file
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/

@John-Lin
Copy link
Contributor

哦 我意思是 gw 可能是1.2.3.4或其他的IP

@sufuf3
Copy link
Contributor Author

sufuf3 commented Jul 24, 2018

GW 0.0.0.0 表示該路由是直接由 local 傳送,所以 pod 可以被 Create 起來
因為 pod 只和 node 上的 OVS 連接,目前測試 OVS 的 uplink 沒有接到 host 上面的 port [圖一] 。所以沒有可以用的 GW 到達 route。
所以無法被 create,得到 “network is unreachable” 的 error,如圖二

  • 圖一
$ 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
  • yaml file
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/

@John-Lin
Copy link
Contributor

ok 了解!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants