• Stars
    star
    160
  • Rank 234,703 (Top 5 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Run performance tests in Kubernetes cluster with Kangal

Kangal - Automatic loader

Artifact HUB codecov

Run performance tests in Kubernetes cluster with Kangal.


Table of content

Why Kangal?

In Kangal project, the name stands for "Kubernetes and Go Automatic Loader". But originally Kangal is the breed of a shepherd dog. Let the smart and protective dog herd your load testing projects.

With Kangal, you can spin up an isolated environment in a Kubernetes cluster to run performance tests using different load generators.

Key features

  • create an isolated Kubernetes environment with an opinionated load generator installation
  • run load tests against any desired environment
  • monitor load tests metrics in Grafana
  • save the report for the successful load test
  • clean up after the test finishes

How it works

Kangal application uses Kubernetes Custom Resources.

LoadTest custom resource (CR) is a main working entity. LoadTest custom resource definition (CRD) can be found in charts/kangal/crds/loadtest.yaml.

Kangal application contains two main parts:

  • Proxy to create, delete and check load tests and reports via REST API requests
  • Controller to operate with LoadTest custom resource and other Kubernetes entities.

Kangal also uses S3 compatible storage to save test reports.

Supported backends

Currently, there are the following load generator types implemented for Kangal:

Read more about each of them in docs/index.md.

Architectural diagram

The diagram below illustrates the workflow for Kangal in Kubernetes infrastructure.

Architectural diagram

Components

LoadTest Custom Resource

A new custom resource in the Kubernetes cluster which contains requirements for performance testing environments.

More info about the Custom Resources in official Kubernetes documentation.

Kangal Proxy

Provides the following HTTP methods for /load-test endpoint:

  • POST - allowing the user to create a new LoadTest
  • GET - allowing the user to see information (status/logs/report) for specific LoadTest and get an overview for all the currently existing loadtests
  • DELETE - allowing the user to stop and delete existing LoadTest

The Kangal Proxy is documented using the OpenAPI Spec.

If you prefer to use Postman you can also import openapi.json file into Postman to create a new collection.

Kangal Controller

The component is responsible for managing all the aspects of the performance testing process.

Quickstart guide

This tutorial will guide through Kangal installation process and usage.

Installing using helm

First, add the repository to Helm:

helm repo add kangal https://hellofresh.github.io/kangal

Now, install the chart using the following command:

helm install kangal kangal/kangal

That's it, Kangal should be installed, check if is all correct by running:

$ kubectl get pods
NAME                                 READY   STATUS    RESTARTS   AGE
kangal-controller-588677b854-r9qcs   1/1     Running   0          44s
kangal-openapi-ui-7c5dd8997c-jj4mk   1/1     Running   0          44s
kangal-openapi-ui-7c5dd8997c-vgm8c   1/1     Running   0          44s
kangal-proxy-7d95c9d65-6t44b         1/1     Running   0          44s
kangal-proxy-7d95c9d65-75dv4         1/1     Running   0          44s

$ kubectl get crd
NAME                              CREATED AT
loadtests.kangal.hellofresh.com   2020-10-05T13:22:59Z

For more information about the Helm Chart check charts/kangal/README.md.

Creating first LoadTest

To run a LoadTest you first need to find Kangal proxy endpoint. Use this command:

$ kubectl get ingress
NAME                HOSTS                           ADDRESS     PORTS   AGE
kangal-openapi-ui   kangal-openapi-ui.example.com   localhost   80      5m48s
kangal-proxy        kangal-proxy.example.com        localhost   80      5m48s

This is assuming you have a properly configured Ingress Controller. If it is not the case you can use Port Forwarding.

With this information, you are now able to do a request to create the first load test. Let's start by downloading an example JMeter test and POST it to Kangal proxy.

$ curl -s -O https://raw.githubusercontent.com/hellofresh/kangal/master/examples/constant_load.jmx
$ curl \
    -F "distributedPods=1" \
    -F "testFile=@constant_load.jmx" \
    -F "type=JMeter" \
    http://${KANGAL_PROXY_ADDRESS}/load-test
{
    "type": "JMeter",
    "distributedPods": 1,
    "loadtestName": "loadtest-dunking-hedgehog",
    "phase": "creating",
    "hasEnvVars": false,
    "hasTestData": false
}

Your first load test was created successfully, in this example with the name loadtest-dunking-hedgehog.

Check the load status with:

curl http://${KANGAL_PROXY_ADDRESS}/load-test/loadtest-dunking-hedgehog
{
    "type": "JMeter",
    "distributedPods": 1,
    "loadtestName": "loadtest-dunking-hedgehog",
    "phase": "running",
    "hasEnvVars": false,
    "hasTestData": false
}

Kangal Controller will automatically create a namespace for your load test and deploy the backend (in this case JMeter), check that by running:

$ kubectl get namespaces
NAME                        STATUS   AGE
...
loadtest-dunking-hedgehog   Active   3s

And you can check if the Pods started correctly using:

$ kubectl get pods --namespace=loadtest-dunking-hedgehog
NAME                    READY   STATUS    RESTARTS   AGE
loadtest-master-f6xpb   1/1     Running   0          18s
loadtest-worker-000     1/1     Running   0          22s

Documentation

Read more at docs/index.md.

Contributing

Please check the contribution guide before opening a PR.

Support

If you need support, start with the troubleshooting guide, and work your way through the process that we've outlined.

More Repositories

1

health-go

Library to provide basic healthcheck functionality to Go applications.
Go
521
star
2

eks-rolling-update

EKS Rolling Update is a utility for updating the launch configuration of worker nodes in an EKS cluster.
Python
361
star
3

klepto

Klepto is a tool for copying and anonymising data
Go
291
star
4

goengine

Engine provides you all the capabilities to build an Event sourced application in go
Go
126
star
5

deblibs-gradle-plugin

A Gradle plugin that creates Github issue and Slack message for outdated dependencies so they can easily be tracked and manually upgraded.
Kotlin
73
star
6

kandalf

RabbitMQ to Kafka bridge
Go
72
star
7

stats-go

This is generic stats library that we at HelloFresh use in our projects to collect services' stats and then create monitoring dashboards to track activity and problems.
Go
43
star
8

engine

Engine provides you all the capabilities to build an Event sourced application.
PHP
38
star
9

go-readinglist

Useful links for golang
33
star
10

action-changed-files

GitHub Action for matrix generation based on changed files matched against regular expressions
Python
31
star
11

ansible-sssd-ldap

Jinja
22
star
12

github-cli

A CLI Tool to automate the creation of github repositories
Go
19
star
13

ansible-consul

Ansible Role to install and configure consul
Ruby
15
star
14

logging-go

Go
13
star
15

mysql-replication-monitor

A Python MySQL Replication Monitor with Slack and Email notifications
Python
11
star
16

zendesk-go

Zendesk API build in Go
Go
11
star
17

updater-go

Library that helps verifying/updating go binary with new version
Go
11
star
18

impala-monitor

This a simple Python daemon to monitor your Impala nodes.
Python
10
star
19

tableau-status-exporter

Python
10
star
20

crossengage-python-client

Python client for Crossengage's API
Python
7
star
21

phanes

This is the client generator for an identity provider
Go
7
star
22

jenkins-trigger-console

Is a simple python script that triggers jobs on remote Jenkins and follows the console output.
Python
7
star
23

ausraster

Taking the (╯°□°)╯︵ ┻━┻ out of working with documents
PHP
7
star
24

lentil

Smart and modular gulp wrapper
JavaScript
6
star
25

ansible-oauth2-proxy

An ansible role to install oauth2 proxy
Shell
6
star
26

android-deeplink

Deeplink library for HF Android projects
Kotlin
6
star
27

ansible-rabbitmq

HelloFresh extension of the RabbitMQ playbook which allows clustering.
Ruby
5
star
28

hf-tlsmon

Monitors TLS/SSL hosts
Go
5
star
29

kangal-jmeter

JMeter docker images specifically configured for Kangal
Dockerfile
5
star
30

ginger-middleware

A set of useful middleware for gin
Go
5
star
31

stats-php

Generic stats library collect services' stats and then create monitoring dashboards to track activity and problems
PHP
5
star
32

opentracing-php

[DEPRECATED] OpenTracing API for PHP http://opentracing.io
PHP
5
star
33

appboy-python-client

A Python client for the Appboy REST API
Python
4
star
34

reagieren

A set of adapters for message brokers
PHP
4
star
35

workstation-checks

Specs tests to check your Mac/linux compatibility with a set of best security practices.
Ruby
4
star
36

php70

Base docker image for php 7.0 web apps
Dockerfile
3
star
37

ansible-yum

Simple role to patch a RHEL/Centos system and install default packages.
3
star
38

ssm-cli

CLI for setting and retrieving secrets from AWS SSM
Python
2
star
39

weird-github-client

A weird GitHub client. It does... stuff. For instance, it generates this report.
JavaScript
2
star
40

hf-baseimage

Docker base image for production workloads tailored for HF usage.
Dockerfile
2
star
41

grpc-protoc-plugins

Pipeline and releases for gRPC PHP and Pythin plugins that are not available as prebuilt artifacts
2
star
42

docker-python-ci

Hosts the Python CI Dockerfile
Dockerfile
2
star
43

logstashbrcvr

Relay Logstash heartbeats over HTTP for availability monitoring.
Go
1
star
44

ansible-archive

Ansible role to archive files and folders
1
star
45

docker-awscli

Dockerized AWS CLI.
1
star
46

phpkafka

Binary artifacts for PHP Kafka extension
Shell
1
star
47

ansible-firefox

An ansible role to install multi version of firefox
Ruby
1
star
48

ansible-samson

Create and Manage zendesk Samson
Shell
1
star
49

docker-node-ci

Lightweight Docker container used for building deployment artefacts in Concourse for node apps
Dockerfile
1
star
50

osin-storage

osin-storage fork
Go
1
star
51

logpruner

Prunes logs stored in AWS ElasticSearch Service domains.
Go
1
star