Harness Chaos Engineering logo

Backstage Harness Chaos Engineering Plugin

Created by harness.io

Harness Chaos Engineering helps you test how your system behaves when things go wrong. It lets you run controlled experiments across services and infrastructure, then measure resilience with clear scores and history. It fits into delivery flows so you catch weakness before users do.

This Backstage plugin brings that workflow into your developer portal. You can connect a service in the catalog to a Harness project and see the experiments tied to it. The page shows recent runs with status and resilience score. You can filter by environment or infrastructure. You can narrow the view to a service or application map using tags. When you need deeper context, you can jump to detailed run views in Harness. You can even start an experiment from Backstage when it is safe to do so.

The plugin suits platform engineers, SREs, and service owners who want resilience checks in the same place they work every day. Use it to validate a deployment, to prove rollback behavior, or to rehearse incident runbooks. It reduces tool switching and makes resilience work visible in the catalog. The plugin is listed in the Backstage plugin marketplace which makes discovery and adoption straightforward for teams running self hosted Backstage.

Installation Instructions

These instructions apply to self-hosted Backstage only.

Install the frontend package

Copy
yarn add --cwd packages/app @harnessio/backstage-plugin-harness-chaos
yarn install

Configure a proxy to Harness

Add a proxy entry in your app config. Put your Harness token in the header. Use a Personal Access Token or a Service Account Token.

Copy
# app-config.yaml

proxy:
  '/harness':
    target: 'https://app.harness.io/'
    headers:
      'x-api-key': '<YOUR_PAT_OR_SAT>'

Use your Harness on prem URL for target if you host Harness yourself.

Add the Chaos tab to the entity page

Wire the plugin into the service entity page. Add a new route and render the plugin content. Place this in your app Entity page component.

Copy
// packages/app/src/components/catalog/EntityPage.tsx

import React from 'react';
import { EntityLayout, EntitySwitch } from '@backstage/plugin-catalog';
import { EmptyState } from '@backstage/core-components';
import { Button } from '@material-ui/core';

import {
  EntityHarnessChaosContent,
  isHarnessChaosAvailable,
} from '@harnessio/backstage-plugin-harness-chaos';

const chaosContent = (
  <EntitySwitch>
    <EntitySwitch.Case if={isHarnessChaosAvailable}>
      <EntityHarnessChaosContent />
    </EntitySwitch.Case>

    <EntitySwitch.Case>
      <EmptyState
        title="No Chaos data available for this entity"
        missing="info"
        description="You need to add an annotation to your component if you want to enable Chaos for it. You can read more about annotations in Backstage by clicking the button below."
        action={
          <Button
            variant="contained"
            color="primary"
            href="https://backstage.io/docs/features/software-catalog/well-known-annotations"
          >
            Read more
          </Button>
        }
      />
    </EntitySwitch.Case>
  </EntitySwitch>
);

export const serviceEntityPage = (
  <EntityLayout>
    <EntityLayout.Route path="/chaos" title="Chaos Engineering">
      {chaosContent}
    </EntityLayout.Route>
  </EntityLayout>
);

You will see a Chaos Engineering tab on service entity pages.

Add catalog annotations

Add annotations to your service catalog file. The project URL is required. Application map tags are optional.

Copy
# catalog-info.yaml

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: my-service
  annotations:
    harness.io/project-url: https://app.harness.io/ng/account/<acc>/projects/<proj>/orgs/<org>/chaos

    harness.io/application-map-tags: |
      <nm-name_1>: <nm-label_1>
      <nm-name_2>: <nm-label_2>
spec:
  type: service
  owner: team-a
  lifecycle: production

How it behaves

  1. If only the project URL is present the plugin shows a V1 table with all experiments in the project.
  2. If the project URL plus application map tags are present the plugin shows a V2 table filtered to those tags.
  3. Service tag based filtering will come later.

Optional Harness base URL

Set this if you use a Harness URL that is not the default.

Copy
# app-config.yaml

harness:
  baseUrl: https://app.harness.io/

Enable the Backstage proxy in your backend

The plugin calls Harness through the Backstage proxy. Make sure the proxy backend plugin is enabled.

Old backend system

Install the proxy backend package.

Copy
yarn add --cwd packages/backend @backstage/plugin-proxy-backend

Add a proxy plugin file.

Copy
// packages/backend/src/plugins/proxy.ts

import { createRouter } from '@backstage/plugin-proxy-backend';
import { PluginEnvironment } from '../types';
import { Router } from 'express';

export default async function createPlugin(env: PluginEnvironment): Promise<Router> {
  return await createRouter({
    logger: env.logger,
    config: env.config,
    discovery: env.discovery,
    tokenManager: env.tokenManager,
    httpAuth: env.httpAuth,
  });
}

Register it in the backend index.

Copy
// packages/backend/src/index.ts

import proxy from './plugins/proxy';

// inside the async function that builds the app
const apiRouter = Router();

apiRouter.use('/proxy', await proxy(env));

app.use('/api', apiRouter);

If your app already has the proxy plugin wired you can skip this part.

New backend system

Install the proxy backend package.

Copy
yarn add --cwd packages/backend @backstage/plugin-proxy-backend @backstage/backend-defaults

Register the proxy plugin.

Copy
// packages/backend/src/index.ts

import { createBackend } from '@backstage/backend-defaults';
import { proxyPlugin } from '@backstage/plugin-proxy-backend';

const backend = createBackend();

backend.add(proxyPlugin());

backend.start();

If your app already adds the proxy plugin you can skip this part.

Changelog

This changelog is produced from commits made to the Harness Chaos Engineering plugin since a year ago, and based on the code located here. It may not contain information about all commits. Releases and version bumps are intentionally omitted. This changelog is generated by AI.

Bug fixes

  • Fix background color in Run Status Heat map popover in light mode #158. Merged 7 months ago.

Set up Backstage in minutes with Roadie