Local testing of the Kubernetes stack

These are some brief but essential steps to get everything from cloud-api to cloud-k8s-operator running locally (each of them requires a Python virtualenv with dependencies installed).

  • Start the Brain and Redis:

    $ cd path/to/your/projects/crate/cloud
    $ docker-compose up -d brain redis
    
  • Run cloud-api

    $ cd path/to/your/projects/crate/cloud-api
    $ source path/to/cloud-api-venv/bin/activate
    (cloud-api) $ FLASK_LOGGING=DEBUG FLASK_HOST=127.0.0.1 FLASK_PORT=8080 ENV=local cloud-api
    
  • Run cloud-agent

    $ cd path/to/your/projects/crate/cloud-agent
    $ source path/to/cloud-agent-venv/bin/activate
    (cloud-agent) $ cloud-agent
    
  • Run cloud-api-celery

    $ cd path/to/your/projects/crate/cloud-api
    $ source path/to/cloud-api-venv/bin/activate
    (cloud-api) $ CELERY_LOG_LEVEL=DEBUG LOCAL_ENV=dev/local.env celery worker --app cloud.api.celery.worker.celery --concurrency 1
    

    Depending on the IP address you’ll run cloud-agent on, you might need to change the value for CLOUD_API_AGENT_URL in dev/local.env.

  • Run Minikube and make sure that’s your default Kubernetes context

    $ minikube start
    $ kubectl config use-context minikube
    
  • Run the Kubernetes operator for projects

    $ cd path/to/your/projects/cloud-k8s-operator
    $ source path/to/cloud-k8s-operator-venv/bin/activate
    (cloud-k8s-operator) $ kopf run --verbose --standalone ./cloud/operator/project.py