Telefonica / cerdito

Save a few cents on your cloud infrastructure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cerdito

Made with Rust Gluten Free It works

Piggy Bank

Save a few cents on your cloud infrastructure.

What does cerdito do?

cerdito is configured through a toml file in which you can indicate the Atlas clusters, AKS or Azure Databricks jobs you want to pause and the Kubernetes deployments you want to be scaled to zero. Note that each module goes separately so it is possible to use cerdito only to pause Atlas clusters, AKS, Azure Databricks or to scale deployments to zero.

To connect to Atlas you will need a public key and a private API access key, for AKS or Azure Databricks you will need a Service Principal and for Kubernetes you will need cubeconfig file.

Installation

From binary

Simply download latest release from releases page.

From source

Installing Rust

cerdito build has been tested with current Rust stable release version. You can install Rust from your distribution package or use rustup.

rustup default stable

If you prefer, you can use the stable version only for install cerdito.

rustup override set stable

Building cerdito

To build cerdito simply execute the following commands.

git clone git@github.com:Telefonica/cerdito.git
cd cerdito
cargo build --release

Once it finishes building, you will find the binary in the target/release/ directory.

With Docker

Build docker container.

docker build -t cerdito .

Run docker container.

docker run -t -i --rm cerdito

Now you can execute cerdito command. Remember to create a configuration file cerdito.toml. If you already have one you can run cerdito directly in this way.

docker run -t -i --rm \
  -v $(pwd)/cerdito.toml:/cerdito.toml cerdito \
  cerdito -v -c /cerdito.toml SUBCOMMAND

Run

First take a look to cerdito.toml file to configure cerdito. Is self explanatory.

You can place cerdito.toml in same directory where you run cerdito or where you want as long as you indicate it from the command line or with the CERDITO_CONFIG environment variable.

Once you have configured cerdito you can run cerdito start to resume your cloud infraestructure or cerdito stop to pause it. cerdito has some command line options to tell it where to read the configuration.

Usage: cerdito [OPTIONS] <COMMAND>

Commands:
  start    Start all configured elements
  stop     Stop all configured elements
  version  Prints version information
  help     Print this message or the help of the given subcommand(s)

Options:
  -c, --config <config>          Custom configuration file path
  -k, --kubeconfig <kubeconfig>  Custom kubeconfig file path
  -v, --verbose...               Sets the level of verbosity
  -h, --help                     Print help
  -V, --version                  Print version

By default cerdito does not show anything when it is running, if you want to see what it is doing you can launch it with CERDITO_LOGLEVEL=info environment variable or with -v option.

cerdito supports the following environment variables.

Variable Description
CERDITO_CONFIG Config file location
CERDITO_LOGLEVEL Log level, effective values are error, warn, info, debug and trace
MONGODB_ATLAS_PUBLIC_KEY Atlas public key, to avoid having to write it in the configuration file
MONGODB_ATLAS_PRIVATE_KEY Atlas private key
AZURE_TENANT_ID Azure tenant ID
AZURE_CLIENT_ID Azure SP client ID
AZURE_CLIENT_SECRET Azure SP client secret
KUBECONFIG Location of kubeconfig file, by default ~/.kube/config is used (if not specified in the configuration file)

About

Save a few cents on your cloud infrastructure

License:GNU General Public License v3.0


Languages

Language:Rust 99.1%Language:Dockerfile 0.9%