Categorygithub.com/drorivry/rego
modulepackage
0.1.0
Repository: https://github.com/drorivry/rego.git
Documentation: pkg.go.dev

# README

Rego

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

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

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.

please refer the docs

Use cases

  • Run async workloads that need s 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

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

CLI Installation (Recommended)

curl -L https://raw.githubusercontent.com/drorIvry/rego-cli/main/install.sh | sh

Run on local machine

curl -L  https://raw.githubusercontent.com/drorIvry/rego/main/local-deploy/rego.sh | sh

Prerequisites

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

Clone the repo and run:

go run main.go

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.

API Swagger

browse to http://localhost:4004/swagger/index.htm

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.

TODOs

  • implement a CLI
  • docker deployment
  • support deployment kickoff
  • add workflow options
  • support kubernetes metadata
  • support actual external DBs

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author