Skip to content

Mirage20/cellery-controller

 
 

Repository files navigation

Mesh Controller

Build Status codecov.io Go Report Card GitHub (pre-)release GitHub (Pre-)Release Date GitHub last commit License

Note: If you just wish to get started with trying out Cellery, you can start your journey at wso2/cellery repository.

Mesh controller is a Kubernetes implementation for the Cellery mesh (a.k.a Cell Mesh) builds using Istio. To learn more about about Cellery, check out the wso2/cellery repository.

Getting Started

Mesh Controller requires a Kubernetes cluster with Istio installed in order to work properly.

Prerequisites

  • Golang v1.12+
  • Kubernetes cluster and client v1.14
  • Istio v1.2.2
  • GNU Make 4.1+
  • Docker

Building and Running

  1. Clone this repository to your $GOPATH and enable go module support by setting GO111MODULE=on. Cloning into $GOPATH is only required if you want to use code-generator.

    export GO111MODULE=on
    cd $GOPATH/src/cellery.io/
    git clone https://github.com/wso2/cellery-controller.git
    cd cellery-controller
  2. Build the controller

    # The output binary can be located inside the build directory
    make build.controller 
  3. Run the controller in your local machine (This requires you to provide the kubeconfig file in order to connect to the Kubernetes cluster)

    ./build/controller -logtostderr=true --kubeconfig=/home/<username>/.kube/config

Running the tests

Unit tests

  1. Run the unit tests

    make test.controller
  2. Generate and view coverage report

    make coverage 

Deployment

This will guide you on deploying the Mesh Controller inside the Kubernetes cluster

Deploying a released version

You can deploy a released version of the Mesh Controller using following steps.

  1. Generate Kubernetes YAML’s for the controller

    # Specify a released version to generate the yaml
    VERSION=v0.1.0 make artifacts
  2. Deploy the controller into Kubernetes cluster

    kubectl apply -f build/mesh-controller.yaml

Deploying a development version

If you want to deploy a development version, you can to generate a Kubernetes YAML which uses docker images from your Docker repository.

  1. Build and push the docker image

    DOCKER_REPO=<your-repo> VERSION=dev make docker-push.controller artifacts
  2. Deploy controller into the Kubernetes cluster

    kubectl apply -f build/mesh-controller.yaml

Running a sample Cell

You can create a sample cell using following command,

cat <<EOF | kubectl create -f -
apiVersion: mesh.cellery.io/v1alpha1
kind: Cell
metadata:
  name: my-cell
spec:
  gatewayTemplate:
    spec:
      http:
      - context: time
        definitions:
        - path: /
          method: GET
        backend: server-time
        global: false
      - context: hello
        definitions:
        - path: /
          method: GET
        backend: node-hello
        global: false
  servicesTemplates:
  - metadata:
      name: time-us
    spec:
      replicas: 1
      container:
        image: docker.io/mirage20/time-us
        ports:
        - containerPort: 8080
      servicePort: 80
  - metadata:
      name: time-uk
    spec:
      replicas: 1
      container:
        image: docker.io/mirage20/time-uk
        ports:
        - containerPort: 8080
      servicePort: 80
  - metadata:
      name: server-time
    spec:
      replicas: 1
      container:
        image: docker.io/mirage20/time
        ports:
        - containerPort: 8080
      servicePort: 80
  - metadata:
      name: debug
    spec:
      replicas: 1
      container:
        image: docker.io/mirage20/k8s-debug-tools
      servicePort: 80
EOF

Contributing

If you are interested in contributing please see CONTRIBUTING.md

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.5%
  • Other 0.5%