Skip to content
Lucas Rebscher edited this page Feb 2, 2021 · 48 revisions

drawing

CloudHarness

CloudHarness is a base infrastructure facilitator for micro-service based applications deployed on Kubernetes.

What building your cluster application with CloudHarness gives to you:

  • Common framework and utilities to develop and deploy micro-service application
    • REST-API scaffolding building based on OpenApi (Python-Flask)
    • Helm chart automatic generation
    • Automatic build and push of images
    • Continuous deployment script generation (Codefresh)
  • Prebuilt support applications and shared library to:
    • Log in and user management - based on Keycloak
    • Submit batch and asynchronous workflows - based on Argo
    • Orchestrate Micro-services - based on Kafka

Command line tools

CloudHarness provides the following command line tools to help application scaffolding and deployment.

  • harness-deployment - generate the helm chart to deploy on Kubernetes.
  • harness-application - create a new CloudHarness REST application.
  • harness-generate - generates server and client code for all CloudHarness REST applications.

Get started

Prerequisites

Python 3.7+ must be installed.

It is recommended to setup a virtual environment. With conda:

conda create --name ch python=3.7
conda activate ch

Install requirements:

pip install -r requirements.txt

Local Development

For local development you need to run your own Kubernetes cluster, we recommend to use minikube and follow their Get Started guide.

Additionally, you need to install the CLI tool kubectl to interact with the cluster.

Further reading: Working with Minikube

Generate deployment

To generate a deployment, run harness-deployment.

Further reading: Deployment

Create new REST application

To create a new REST application, run harness-application from the root.

Further reading: Application Templates

Generate server and client code from openapi

To (re)generate the code for your applications, run harness-generate from the root. The script will look for all openapi applications, and regenerate the Flask server code and documentation.

Note: the script will eventually override any manually modified file. To avoid that, define a file openapi-generator-ignore.

Examples

Extend CloudHarness

CloudHarness is born to be extended. In order to extend CloudHarness you just need to mirror the folder structure:

  • applications: place here your custom applications, or override default ones
  • deployment-configuration: override the helm chart default values and templates
  • infrastructure: define base images to use in your application

or simply copy the blueprint folder

  • harness-deployment - generate the helm chart to deploy on Kubernetes.
  • harness-application - create a new CloudHarness REST application.
  • harness-generate - generates server and client code for all CloudHarness REST applications.

How to add a new CloudHarness custom application

  1. Add the application inside applications/[APPLICATION_NAME] with a Dockerfile in it
  2. Define deploy/values.yaml inside the file in order to specify custom values for the application
  3. (optional) define specific helm templates on deploy/values.yaml
  4. Run harness-deployment
  5. Define the helm templates for the application inside deploy/templates. In the helm template, it is recommended to use the automatically generated values helm/ch/values.yaml

See more about the Helm chart installation in the specific README.

How to add an external application

A CloudHarness application can specify a Kubernetes deployment also using externally defined public images. Create a new CloudHarness application with the helm templates inside the deploy subdirectory