For developing features or fixing bugs on legend, please use this guide
brew install jsonnet
git clone https://github.com/grofers/legend.git
cd legend
pip install --ignore-installed -e .
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
Set the appropraite context
kubectl apply -f <>
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
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
Just raise a PR in the Legend github repo