Skip to content

Latest commit

 

History

History
99 lines (69 loc) · 1.86 KB

developing-on-legend.md

File metadata and controls

99 lines (69 loc) · 1.86 KB

Developer's guide

For developing features or fixing bugs on legend, please use this guide

Setup

brew install jsonnet
git clone https://github.com/grofers/legend.git
cd legend
pip install --ignore-installed -e .

Developing on the CLI

Initial Configuration

Legend needs a basic configuration to work with, you can set the root of the legend home dir by setting the env variable LEGEND_HOME. Legend created a folder .legend within the root and refers config (legend.cfg) from that location

Setup the legend.cfg

[grafana]
api_key:
protocol: https
host: grafana-stage.grofer.io

Developing on the CRD

Deploying via CRD

Set the appropraite context kubectl apply -f <>

Minikube Setup

You can set it up in your minikube for trying out and development:

Start minikube:

minikube start

Start a proxy to minikube in a terminal and leave it open:

kubectl proxy

Setup the development environment:

mkvirtualenv legend
pip install --ignore-installed -e .
pip install -r kubernetes/requirements.txt

Setup the CRD and start the operator:

cd kubernetes
kubectl apply -f crd.yaml
GRAFANA_API_KEY=<> GRAFANA_HOST=<> GRAFANA_PROTOCOL=https LEGEND_HOME=<> DEV=true LOG_LEVEL=DEBUG kopf run handler.py

Create your dashboard:

kubectl apply -f test/obj.yaml

Testing

You can test legend by running e2e tests in a completely isolated environment.

Prerequisite

 * Kind
 * Python 3 (use pyenv or virtualenv)
 * Jsonnet
 * Helm3
 * Docker

Following script will spawn a new kubernetes cluster using kind and will install relevent dependencies on kubernetes cluster. Script will automatically clean relevent kind cluster.

chmod +x isolated_legend_e2e_test.sh
./isolated_legend_e2e_test.sh

Deploying / Publishing

Just raise a PR in the Legend github repo