Skip to content

Welcome REGO

rego /ˈre.ɑoː/ verb. Definitions: manage, direct rule, guide

REGO is a modern, fast (high-performance), framework for running any docker image as a kubernetes job with a fully managed api

Go Report Card GoDoc Release pages-build-deployment Build Artifact Hub

Rego is a

  • πŸ”₯ blazingly fast
  • πŸ₯‡ API first
  • 🌈 lightweight
  • πŸ•œ Task orchestrator

It is designed to allow asynchronous workloads to be deployed over Kubernetes with minimal effort, while also providing a management API that can keep track of progress and run history.

Star us on github.

Use cases

  • Run async workloads that needs to be managed (or visible to) a UI
  • Integrate non production-grade code (data scientist's R code for example) within your production environment in a contained way
  • Use to run stuff periodically with run history

Requirements

  • Go: any one of the three latest major releases (we test it with these).

  • Kubernetes: tested on v1.24+

Installation

Kubernetes

kubectl apply -f https://raw.githubusercontent.com/drorIvry/rego/main/deploy/deployment.yml

Helm

helm repo add rego https://drorivry.github.io/rego-charts/
helm install --generate-name rego/rego
curl -L https://raw.githubusercontent.com/drorIvry/rego-cli/main/install.sh | sh

Quick Start

Using the CLI

rego comes with a pre-built CLI to use rego

after installing the cli you can use the rego command to operate rego

test the connection

rego ping

deploy an image:

rego run -i hello-world

a more complex deployment

rego run -d "$(cat << EOF 
{
  "image": "hello-world",
  "name": "test",
  "args": "[\"1111\", \"33333\"]",
  "namespace": "default",
  "execution_interval": 0,
  "ttl_seconds_after_finished": 10,
  "metadata": {
    "ttlSecondsAfterFinished": 10,
    "completions": 10,
    "parallelism": 10
  }
}
EOF)"

Using the API

With rego you can use the API to create and run k8s jobs with a managed API.

curl -X POST -d '{"image": "hello-world"}' localhost:4004/api/v1/task

This will start a job on your k8s cluster that'll run the docker image hello-world

the response will look something like

{
  "definition_id": "a36fbd9b-bf8a-4c59-94c1-9938b6707e8f",
  "message": "created"
}

we can use the definition ID to see the task's running status

curl http://localhost:4004/api/v1/task/a36fbd9b-bf8a-4c59-94c1-9938b6707e8f/latest

which will respond with

{
  "ID": 0,
  "CreatedAt": "2023-04-02T11:53:08.2008054+03:00",
  "UpdatedAt": "2023-04-02T11:53:16.2032147+03:00",
  "DeletedAt": null,
  "id": "7eb53d97-7380-4e0b-82a6-b38fbf9119d2",
  "task_definition_id": "a36fbd9b-bf8a-4c59-94c1-9938b6707e8f",
  "status_code": 500,
  "status": "SUCCESS",
  "image": "hello-world",
  "name": "test",
  "ttl_seconds_after_finished": 10,
  "namespace": "test",
  "args": "[\"1111\", \"33333\"]",
  "metadata": {
    "ttlSecondsAfterFinished": 1
  }
}

which indicates the success.

Contributing

We welcome contributions from the community! If you'd like to contribute to the project, please follow these guidelines:

  • Fork the repository
  • Create a new branch: git checkout -b new-feature
  • Make your changes and commit them: git commit -m "Add new feature"
  • Push your changes to your fork: git push origin new-feature
  • Create a pull request to the main repository

License

This project is licensed under the MIT License. See the LICENSE file for details.