Deployment notes:
- Dev container: any regular ubuntu container should do but requires (1) docker socket (2) host network
set -x
docker run -d \
--name mantis-dev \
--network=host \
-v /var/run/docker.sock:/var/run/docker.sock \
ubuntu:18.04 bash -c "while true;do sleep 1000;done"- Inside the dev contianer, download and install k3d following instruction https://github.com/rancher/k3d
create the cluster as follows
set -ex
k3d create --publish 7000:32700@k3d-k3s-default-worker-0 --workers 1
KUBECONFIG="$(k3d get-kubeconfig --name='k3s-default')"
cat $KUBECONFIGThis will printout kubeconfig on the screen. This file contains the secret to access the cluster. Make sure you have access to this file when running mantis controllers.
The dev environment assumes the following installed: kubectl
-
Prepare sheel environment: make sure your KUBECONFIG environment variable is set to the kubeconfic file.
-
Install all the dependencies of the controller
-
Start a trial
- go to ./k8s folder in mantis-module
- kubectl apply -f redis.yaml
- kubectl get service --watch # watch for redis to combine healthy
- kubectl apply -f worker.yaml
- kubectl get deployment --watch # watch for all worker pod started successfully
- kubectl apply -f load_gen.yaml # kick off the job
- then run your controller script.
-
Cleanup a trial
- go to ./k8s folder
- kubectl delete -f .
-
Limitation
- Fractional replica:
- There is a mechanism to adjust fractional replica in redis.
- Controller does not hook into fractional replica.
- Need to deploy a fraction replica pod/deployment.
- Delayed spin-up time:
- Might not a concern right now. But replicas start working when they are ready.
- Most likely they are faster than start than we expected.
- Spin-down cleanup issue:
- In some cases, a replica gets killed before it can drain its queue.
- There are some configuration need to be made inside worker.yaml to adjust the spin down timeout and signal sent.
- Traces file:
- currently they are hard coded and copied to the docker container
- might use persistent value for it
- or it could just be more straight forward to move all traces to the docker container
- Docker images running as root right now. We will need to change it for both the base image and the k3s worker image.
- Query traces are not written to file. This should be easy fix to be taken care of by the controller.
- Fractional replica:
-
Resource
- mantis.cc is the redis module code. It should be straighforward to read it.
- python directory is structured to be a command line application. you can install it via
pip install -e .inside the python directory.
Docker image needs at least: