april

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 4 Imported by: 0

README

April

April is under construction

April proposes improve resilience in microservices architectures. It does chaos testing by randomly shutting down services, taking into account their importance.
April is a CLI tool, being possible to either run chaos testing or others tools, such as 'server' which hosts an API for remote access to the chaos test. The selection algorithm firstly picks K services, then it picks N dependencies on those services. Heavy services are more likely to be picked.
It's important that Chaos Server is running to terminate instances.

Tools

Chaos test. Need a running 'chaos server' to terminate instances.
-f configuraion file path (Default is conf.yml)
-n maximum number of services to choose
-c chaos server endpoint (Default is localhost:7071)
-u username for chaos server auth
-s password for chaos server auth

april -f conf.yml -n 10 -u bob -s mysecret

Bare runs only the selection algorithm, returning a set of services.
-f configuraion file path
-n maximum number of services to choose

april bare -f conf.yml -n 10  

Server hosts an API (HTTP) which apply chaos testing and bare algorithm. Need a running 'chaos server' to terminate instances.
-p port number (Default is 7070)
-c chaos server endpoint (Default is localhost:7071)

april server -p 8080  // will listen on port 8080

Configuration file

Fields
version: could be ommited, default is 1
services: describes a list of services
servicename: is the name of a service that April is going to work
weight: represents the service importance for the April pick algorithm
depedencies: describe a list of services which the service depends
selector: describe how chaos server must search for the service name. E.g if you are using docker containers and a framework such as docker compose, compose will define the container name as a concatenation between your service name and a hash somewhere, in this case, it is better to look for the infix corresponding to the service.

# template
version: 1
services:
    servicename:
        weight: [0-9]+ (any natural number)
        dependencies:
            - [a-zA-Z\_\-]* (dependency name)
        selector: prefix|infix|postfix|all (how should match the service name instance)

Example conf.yaml

version: 1
services:
  payment:
    weight: 10
    dependencies:
      - profile
      - fees
    selector: postfix  

  fees:
    weight: 5
    selector: infix  

  profile:
    weight: 20
    selector: infix  

  inventory:
    weight: 15
    selector: infix  

  shipping:
    weight: 5
    dependencies:
      - inventory
      - profile
    selector: infix  

  storefront:
    weight: 20
    dependencies:
      - shipping
      - inventory
      - profile
      - payment
      - fees
    selector: infix

Design approach

The Aprils design is divided into two parts: CLI and Chaos server. CLI runs the algorithm and request to Chaos server for terminate instances. Therefore, we gain flexibility about technologies that manage instances, a Chaos server could terminate Docker containers, Kubernetes instances etc.

Aprils design

What is a Chaos server ?

Chaos server hosts an API that terminantes instances. Aprils CLI runs its algorithm and asks the Chaos server to finish the selected instances. The API implementation lives in april/destroyer package, so chaos servers must include that package and implement the Destroyer interface, which contain the business logic for terminate instances.

Chaos Servers

Docker chaos server stop containers dockercs.
(Under development) Kubenetes chaos server terminate pods kubernetescs, in future it may terminate deployments and services.

Documentation

Overview

Package april implements chaos test tool.

April proposes improve resilience in microservices architectures. This does chaos testing by randomly shutting down nodes, taking into account their importance. April is a CLI tool, being possible to either run chaos testing or others tools, such as 'server' which hosts an API for remote access to the chaos test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PickRandDeps added in v1.0.0

func PickRandDeps(data []byte, quantity uint32) ([]string, error)

PickRandDeps picks random nodes described in a yaml file as a slice of byte

func PickRandDepsConf added in v1.0.0

func PickRandDepsConf(conf *ConfData, quantity uint32) ([]string, error)

PickRandDepsConf picks random nodes from ConfData datastructure

func PickRandDepsYml added in v1.0.0

func PickRandDepsYml(filePath string, quantity uint32) ([]string, error)

PickRandDepsYml picks random nodes as PickRandDeps, but it read a yaml file

Types

type ConfData

type ConfData struct {
	Version  int32       `yaml:"version"`
	Services ConfService `yaml:"services"`
}

ConfData stores the configuration data

func ReadConf

func ReadConf(conf []byte) (*ConfData, error)

ReadConf reads bytes and convert to an service data structure

type ConfService

type ConfService map[string]struct {
	Weight       uint32   `yaml:"weight"`
	Dependencies []string `yaml:"dependencies"`
	Selector     string   `yaml:"selector"`
}

ConfService stores service data

type Service

type Service struct {
	Name     string
	Selector string
}

Service describes some attributes of a service

Directories

Path Synopsis
Package auth provides authentication operations
Package auth provides authentication operations
Package cli implements commands for chaos testing.
Package cli implements commands for chaos testing.
Package destroyer provides an API for chaos servers.
Package destroyer provides an API for chaos servers.
cli
request
Package request implements requests for destroyer server.
Package request implements requests for destroyer server.
internal
Package selector implements a string matcher.
Package selector implements a string matcher.
Package server hosts an API for chaos testing.
Package server hosts an API for chaos testing.

Jump to

Keyboard shortcuts

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