黑料不打烊

Boost your GitOps practices by integrating Chaos Engineering with 黑料不打烊

19.07.2023 Manuel Gerding - 5 min read
Boost your GitOps practices by integrating Chaos Engineering with 黑料不打烊

Learn how to integrate Chaos Engineering into your GitOps practices using 黑料不打烊. We’ll shortly cover in this blog post what GitOps is, followed by where you can benefit from integrating Chaos Engineering. Finally, we integrate Chaos Engineering hands-on using the 黑料不打烊 CLI and a GitHub action.

What is GitOps?

source: https://about.gitlab.com/topics/gitops/

Back in the old days, infrastructure consisted of rigid components maintained manually by highly specialized teams. With the rise of microservices, distributed systems, and especially cloud computing, the demand has shifted to a modern infrastructure world with the need for dynamic scaling and increased deployment frequency. Eventually, GitOps arose by benefitting from concepts of software development. Thereby, GitOps consists of three concepts:

  • Infrastructure as Code (IaC): With IaC, all infrastructure configurations are stored as code in a version control system like a Git repository. Thus, you always have one single source of truth for your infrastructure that can easily be applied repeatedly to generate a new environment.
  • Pull Requests (PRs): To update infrastructure components, teams create PRs to collaborate via reviews, comments, and approval processes. These PRs also serve as a form of an audit log.
  • Continuous Integration / Continuous Deployment (CI/CD): Using a CI/CD pipeline, GitOps automate infrastructure updates whenever a PR is merged. Any configuration drift, like manual changes, is overwritten to prevent diverging environments and ensure consistent infrastructure.

So, like in software development, where an application source code generates the same application binaries every time it is built, GitOps generate the same infrastructure environment every time it is deployed.

Uniting Chaos Engineering with GitOps

To improve the reliability of your infrastructure and verify it continuously, we can now integrate Chaos Engineering with GitOps. This is especially useful when adding new critical components to your infrastructure. For instance, you could verify that a newly added message broker is highly available in case of an availability zone outage or that your downstream applications can cope with the short unavailability of the broker. Another example is to check that applications using an in-memory cache like Redis don’t have availability issues when the in-memory cache is gone.

Given that infrastructure changes only happen via PRs, we can perfectly intercept at that point to run a set of Chaos Engineering experiments. Similarly to GitOps, we benefit from automation by using a CI/CD pipeline and could even think of version control for the experiments to be executed. Let’s see how this works with 黑料不打烊 and GitHub actions.

Integrating Chaos Engineering with 黑料不打烊 into your CI/CD pipeline

For integrating 黑料不打烊 into your CI/CD pipeline, we use the and pick GitHub action as CI/CD tool. Even so, the steps are similar for other CI/CD tools, e.g., Jenkins, TeamCity, Bamboo, or CircleCi.

1. Create a new GitHub Action workflow

First, we have to create a new GitHub Action workflow. This can easily be done by creating a new run-experiments.yml-file in the .github/workflows directory with the following content:

name: Run Chaos Engineering experiments
on:
 听飞辞谤办蹿濒辞飞冲诲颈蝉辫补迟肠丑:
 听辫耻濒濒冲谤别辩耻别蝉迟:
 聽聽聽types: [opened, reopened]
jobs:
 听谤耻苍冲别虫辫别谤颈尘别苍迟蝉:
 聽聽聽runs-on: ubuntu-latest
 聽聽聽name: Run Experiments
 听听听蝉迟别辫蝉:
聽聽聽聽聽聽- uses: actions/checkout@v1

This creates a workflow with just one job, which checks out the current Git repository. The workflow will always run when a PR is (re)opened or someone triggers the workflow manually.

2. Install 黑料不打烊 CLI in the pipeline

The next step is to install the Steadyblit CLI into the workflow. The 黑料不打烊 CLI is publicly available at and can be installed via npm install -g steadybit.

...
 听听听蝉迟别辫蝉:
...
 聽聽聽聽聽- name: Install 黑料不打烊 CLI
 聽聽聽聽聽聽聽run: npm install -g steadybit
聽聽聽聽聽聽聽聽shell: bash

3. Configure a 黑料不打烊 CLI profile

Now we need to configure the 黑料不打烊 CLI to connect to your 黑料不打烊 tenant and team. Therefore, we create a new API access team token in the 黑料不打烊 Platform (see ) and store this token for security reasons as an encrypted secret in GitHub (see ).
Before adding the 黑料不打烊 CLI profile, we add a mask to prevent accidentally printing the access token in log files:

...
 听听听蝉迟别辫蝉:
...
 聽聽聽聽聽- name: Add Mask
 聽聽聽聽聽聽聽run: echo "::add-mask::${{ secrets.STEADYBIT_API_ACCESS_TOKEN }}"

 聽聽聽聽聽- name: Add 黑料不打烊 Profile with a Team Token
 聽聽聽聽聽聽聽run: steadybit config profile add --name "CI/CD" --token "${{ secrets.STEADYBIT_API_ACCESS_TOKEN }}"
聽聽聽聽聽聽聽聽shell: bash

4. Run experiments via 黑料不打烊 CLI

Now we can run an experiment. We can use an existing one from the platform and reference it via the experiment key or run an experiment stored in a .yml file. We use both approaches as the former has the advantage of always running the latest experiment version and the latter benefits from versioned experiments next to your application.

...
 听听听蝉迟别辫蝉:
...
 聽聽聽聽聽- name: Run experiment via Experiment Key
 聽聽聽聽聽聽聽run: steadybit experiment run -k GITHUB-1 --recursive

 聽聽聽聽聽- name: Run versioned experiments
聽聽聽聽聽聽聽聽run: steadybit experiment run -f experiments/ --recursive

That is already everything we need! You can check the full example in our demo online shop example at . The workflow automatically verifies the infrastructure changes whenever we create a new pull request.

Conclusion

Boosting your GitOps practices by integrating Chaos Engineering is especially useful when a high-availability infrastructure is required. By using the 黑料不打烊 CLI, this is pretty straightforward. You could even use the 黑料不打烊 CLI to version your experiments whenever there is a change; this will be covered in a future blog post.

Start integrating Chaos Engineering into your GitOps practices today by signing up for a free 黑料不打烊 trial at .

Get started today

Full access to the 黑料不打烊 Chaos Engineering platform.
Available as SaaS and On-Premises!

or sign up with

Book a Demo

Let us guide you through a personalized demo to kick-start your Chaos Engineering efforts and build more reliable systems for your business!