raccoon

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

raccoon

raccoon logo

Contributor Covenant

Description

Raccoon is a Command Line Interface aiming to provide ephemerality in a kubernetes environment. Ephemerality is a concept of things being transitory, existing only briefly.

Ephemerality will help to:

  • reduce hacks probability on a pod
  • avoid memory leak pitfalls
  • ensure to not rely on long-running workloads
  • ensure that we can restart a pod whenever we want/need
  • help enforcing immutability

For now, raccoon is only capable of collecting kubernetes pods resources.

Strategies

As raccoon is primarly focused on deleting pods. Those pods can start at the same time, when a new deployment happens, deleting pods with a same start time will result in a service unavailability.
To avoid this pitfall, raccoon is able to delete pods based on a strategy.

Randomized Delay

For now, there is only one strategy, called randomizedDelay which basically dispatch deletion over a certain time interval, to prevent service unavailability.

Build and install from source

Prerequisite tools
  • Docker daemon
  • Git
  • Go
  • pre-commit (used to generate README file for the helm chart)
Install from Github

Pre-requisites

# Install golangci-lint
## MacOS
brew install golangci-lint
## Linux & Windows
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2

# Verify
golangci-lint --version

# Install pre-commit hook
pre-commit install
mkdir $HOME/src
cd $HOME/src
git clone https://github.com/backmarket-oss/raccoon.git
cd raccoon
make install

Usage

Each raccoon's flag is available as an environment variable with RACCOON_ as prefix.

Here is the available commands in raccoon

garbage

Used to run raccoon daemon and start marking and collecting k8s pods.
namespace and selector are the two mandatory flags.

For now, we have only one strategy to collect resources, it is the randomized delay strategy.
At each --check-interval and for each resource to collect we apply a --randomized-delay to avoid deleting all the resources in one shot.

$ raccoon garbage

Run raccoon daemon

Usage:
  raccoon garbage [flags]

Flags:
      --check-interval int     Interval between two raccoon check (default 120)
      --dry-run                Test process without deletion
  -h, --help                   help for garbage
      --kube-location string   Connection mode to the kubernetes api (in or out) (default "in")
      --kubeconfig string      Path to KUBECONFIG file. Ignored if KUBECONFIG envvar is set (default "${HOME}/.kube/config")
  -n, --namespace string       Namespace to raccoon (required)
      --randomized-delay int   Delay the deletion by a randomly amount of time [value/2,value] (default 120)
  -s, --selector string        Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) (required)
      --ttl string             Minimum age by which a pod will be deleted (default 24h0m0s)

Global Flags:
      --level string   set log level (default "info")

About the project

Getting involved and contributing

See contribute.

Why naming it raccoon?

Since they are omnivores, berries, fruit, eggs, lizards, crustaceans, fish, wild birds, domestic poultry, and garbage scraps are their main source of food. This is why they eat "garbage". To them, it is just another source of food that is easily accessible.

They eat "garbage", that is what we do in this project. Collecting and deleting garbage resources.

License

Raccoon is released under the Apache 2.0 license. See LICENSE

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
k8s

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL