stackube/doc/source/developer.rst
Harry Zhang 76ef989737 Use trp to handle network
Change-Id: I1ff5c2d858d4f68a98867ef845887200b9561af0
2017-06-28 19:22:08 +08:00

2.7 KiB

Developer Document

This page describes how to setup a working development environment that can be used in developing stackube on Ubuntu or CentOS. These instructions assume you're already installed git, golang and python on your host.

Stackube controller

Build

make build

The binary will be placed at:

_output/stackube-controller

Start

./_output/stackube-controller -v=5 -alsologtostderr=true -logtostderr=true

Test

  1. Prepare Tenant and Network
$ cat test-tenant.yaml

apiVersion: "stackube.kubernetes.io/v1"
kind: Tenant
metadata:
  name: test
spec:
  username: "test"
  password: "password"


$ cat test-network.yaml

apiVersion: "stackube.kubernetes.io/v1"
kind: Network
metadata:
  name: test-net
  namespace: test
spec:
  cidr: "192.168.0.0/24"
  gateway: "192.168.0.1"
  1. Create new Tenant and its Network in Kubernetes
$ export KUBECONFIG=/etc/kubernetes/admin.conf
$ kubectl create -f ~/test-tenant.yaml
$ kubectl create -f ~/test-network.yaml
  1. Check the Network and Tenant is created in Neutron by Stackube controller
$ source ~/keystonerc_admin
$ neutron net-list
+--------------------------------------+----------------------+----------------------------------+----------------------------------------------------------+
| id                                   | name                 | tenant_id                        | subnets                                                  |
+--------------------------------------+----------------------+----------------------------------+----------------------------------------------------------+
| 421d913a-a269-408a-9765-2360e202ad5b | kube_test_test-net | 915b36add7e34018b7241ab63a193530 | bb446a53-de4d-4546-81fc-8736a9a88e3a 192.168.0.0/24      |
  1. Check Network object is created in Kubernetes
$ kubectl get network test-net --namespace=test
 NAME        KIND
 test-net   Network.v1.stackube.kubernetes.io
  1. Delete the Network from Kubernetes
$ kubectl delete -f test-network.yaml
  1. Check Network in Neutron is also deleted by Stackube controller
$ neutron net-list
+--------------------------------------+---------+----------------------------------+----------------------------------------------------------+
| id                                   | name    | tenant_id                        | subnets                                                  |
+--------------------------------------+---------+----------------------------------+----------------------------------------------------------+