CentaurusInfra / mizar

Mizar – Experimental, High Scale and High Performance Cloud Network https://mizar.readthedocs.io
https://mizar.readthedocs.io
GNU General Public License v2.0
111 stars 50 forks source link

[Fornax-Mizar-Integration] control plan changes #582

Closed jshaofuturewei closed 2 years ago

jshaofuturewei commented 2 years ago

There are two major changes.

Add a new VNI field in yaml files to create VPC using predefined VNI

If you don't have any vni settings, it will have a random vni set as usual. If there is duplicated vni, the vpc status will be updated to Error.

a. Run the following command to create a vpc with customized vni.

kubectl apply -f mizar/obj/tests/test_vpc_with_vni.yaml

And you will get the following vpc with vni 10

ubuntu@ip-172-30-0-62:~/mizar$ kubectl get vpcs vpc10
NAME    IP             PREFIX   VNI   DIVIDERS   STATUS        CREATETIME   PROVISIONDELAY
vpc10   192.168.10.0   24       10    1          Provisioned

b. Run the following command to create a vpc with a duplicated vni.

kubectl apply -f mizar/obj/tests/test_vpc_with_dup_vni.yaml

And you will get the following vpc whose status is Error

ubuntu@ip-172-30-0-62:~/mizar$ kubectl get vpcs vpc11
NAME    IP             PREFIX   VNI   DIVIDERS   STATUS   CREATETIME   PROVISIONDELAY
vpc11   192.168.11.0   24       10    1          Duplicate vni

c. Run the following command to create a vpc without vni

kubectl apply -f mizar/obj/tests/test_vpc_with_no_vni.yaml

And you will get the following vpc whose vni has been set to a random number

ubuntu@ip-172-30-0-62:~/mizar$ kubectl get vpcs vpc12
NAME    IP             PREFIX   VNI       DIVIDERS   STATUS        CREATETIME   PROVISIONDELAY
vpc12   192.168.10.0   24       2771449   1          Provisioned

Added portal host to configmap

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
  name: cluster-gateway-config
  namespace: default
data:
  gateway_host_ip: 172.31.15.208
EOF

Verify the config has been added successfully

root@ip-172-31-2-32:~/mizar_cluster_scripts# kubectl get configmap cluster-gateway-config -o json
{
    "apiVersion": "v1",
    "data": {
        "gateway_host_ip": "172.31.15.208"
    },
    "kind": "ConfigMap",
    "metadata": {
        "annotations": {
            "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"portal_host_ip\":\"172.31.15.208\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"name\":\"cluster-gateway-config\",\"namespace\":\"default\"}}\n"
        },
        "creationTimestamp": "2021-12-10T20:40:09Z",
        "name": "cluster-gateway-config",
        "namespace": "default",
        "resourceVersion": "1226",
        "uid": "a344336f-c954-4b9b-a4fa-acbd1e2ec363"
    }
}

The host 172.31.15.208 has been added as cluster gateway. So that all the subnets in the cluster, whose remote deployued flag is false) won't use the host to create bouncers

root@ip-172-31-2-32:~/mizar_cluster_scripts# kubectl get subnet net1
NAME   IP            PREFIX   VNI   VPC    STATUS        REMOTEDEPLOYED   BOUNCERS   CREATETIME   PROVISIONDELAY
net1   192.168.0.0   24       2     vpc1   Provisioned                    1

root@ip-172-31-2-32:~/mizar_cluster_scripts# kubectl get  bouncers
NAME                                          VPC    NET    IP              MAC                 DROPLET            STATUS        CREATETIME                   PROVISIONDELAY
net1-b-31c84764-d798-4213-8b6c-c062994367bd   vpc1   net1   172.31.15.85    0a:a7:d2:0e:4b:bb   ip-172-31-15-85    Provisioned   2021-12-10T20:40:10.791154   0.591665

If a subnet remote deployed flag is true, it will use the given cluster gateway as bouncers

root@ip-172-31-2-32:~/mizar_cluster_scripts# kubectl get subnet net2
NAME   IP              PREFIX   VNI   VPC    STATUS        REMOTEDEPLOYED   BOUNCERS   CREATETIME   PROVISIONDELAY
net2   192.168.122.0   24       2     vpc1   Provisioned   true             1

root@ip-172-31-2-32:~/mizar_cluster_scripts# kubectl get  bouncers
NAME                                          VPC    NET    IP              MAC                 DROPLET            STATUS        CREATETIME                   PROVISIONDELAY
net2-b-f0b83bb9-1c4b-4b44-942b-44f7bb722c73   vpc1   net2   172.31.15.208   0a:c5:74:b5:4b:65   ip-172-31-15-208   Provisioned   2021-12-10T20:40:10.948333   0.675322
jshaofuturewei commented 2 years ago

@vinaykul I changed "remoteDeployed" to "virutal" as you suggested to make it more clear.