Thanks for your interest in improving Chaos Mesh! This document provides a step-by-step guide for contributing to the project.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/chaos-mesh/chaos-mesh/llms.txt
Use this file to discover all available pages before exploring further.
Before You Start
Before starting work on something major, please reach out to us via:- GitHub: Open an issue to discuss your proposed changes
- Slack: Join
#project-chaos-meshin the CNCF Slack - Twitter: Follow us @chaos_mesh
- No one else is already working on it
- The approach aligns with project goals
- You get necessary guidance and support
For developing a specific chaos type, refer to the Developer Guide for detailed architecture and implementation guidance.
Submitting a Pull Request
Follow these steps to submit a successful PR:Step 1: Make Changes
1.1 Fork and Clone
Fork the Chaos Mesh repository and clone it locally:1.2 Set Up Upstream Remote
Configure your local repository to track the upstream repository:1.3 Disable Pushing to Upstream Master
Prevent accidentally pushing to upstream:1.4 Create a Working Branch
Get your local master up-to-date and create your working branch:1.5 Make Your Changes
You can now edit the code on thenew-feature branch.
If you need to update CRD manifests according to your struct changes:
1.6 Check Your Changes
Run quality checks to ensure your code passes all requirements:make generate: Regenerates all generated codemake vet: Runsgo vetmake lint: Runsrevivelintermake fmt: Formats code withgoimportsmake tidy: Ensuresgo.modis tidymake install.sh: Regenerates install scriptmake helm-values-schema: Updates Helm values schema
Step 2: Run Unit Tests
Before testing in a real Kubernetes cluster, ensure all unit tests pass:- Enables failpoint support for testing
- Runs all tests in the project
- Generates code coverage reports
Tests run with
USE_EXISTING_CLUSTER=false to use the envtest framework, which doesn’t require a real cluster.Step 3: Manual Testing
Test your changes in a real Kubernetes cluster:- Set up a development environment following the Configure the Development Environment guide
- Deploy your changes to the cluster
- Create and run chaos experiments to verify your changes work as expected
- Monitor logs and metrics to ensure everything functions correctly
Step 4: Commit and Push Changes
Congratulations! You’ve finished testing and are ready to commit.4.1 Sync Your Branch
Keep your branch in sync with upstream:4.2 Commit with Sign-off
Commit your changes with sign-off:- Summarizes what changed
- Explains why the change was made
- References any related issues
4.3 Push to Your Fork
Push your changes to your forked repository:Step 5: Create a Pull Request
- Navigate to the Chaos Mesh repository
- Click “New Pull Request”
- Select your fork and branch
-
Fill out the pull request template with:
- Description: What changes you made and why
- Related Issue: Link to the issue this PR addresses
- Type of Change: Bug fix, feature, documentation, etc.
- Testing: How you tested these changes
- Checklist: Complete all items in the PR template checklist
- Submit the pull request
Step 6: Get a Code Review
Once your pull request is opened:- Reviewers Assigned: At least two reviewers will be assigned
-
Code Review: Reviewers will check for:
- Correctness and bugs
- Opportunities for improvement
- Documentation and comments
- Code style and best practices
-
Address Feedback: Commit changes made in response to review comments to the same branch:
-
Continuous Integration: Ensure all CI checks pass:
- Unit tests
- E2E tests
- Linting and formatting
- Security scans
- Approval and Merge: Once approved, a maintainer will merge your PR
Development Guidelines
Code Quality Standards
- Formatting: Use
goimportswith-local github.com/chaos-mesh/chaos-mesh - Linting: Pass
revivechecks (configuration inrevive.toml) - Testing: Add unit tests for new functionality
- Documentation: Update docs for user-facing changes
- Comments: Add clear comments for complex logic
Controller Development
When adding or modifying controllers, follow these principles:- One Controller Per Field: Each field should be controlled by at most one controller
- Standalone Operation: Controllers should work independently
- Simple Behavior: Controller logic should be describable in ~100 words
- Error Handling: Use
ctrl.Result{Requeue: true}, nilfor retriable errors
Multi-Module Project
Chaos Mesh is a multi-module Go project. When updating dependencies, run
go mod tidy in all directories:- Root directory
api/e2e-test/e2e-test/cmd/e2e_helper/
Communication Channels
Community Meetings
Chaos Mesh Community Monthly- Time: Fourth Thursday of every month
- RSVP here
- Meeting minutes
- Time: Every other Tuesday
- RSVP here
- Meeting minutes
Getting Help
- GitHub Issues: Report bugs or request features
- CNCF Slack: Join
#project-chaos-meshfor real-time discussions - Twitter: Follow @chaos_mesh for updates
Resources
- Developer Guide - Comprehensive development documentation
- Build System - Understanding the build infrastructure
- Official Documentation - User and developer guides
- GitHub Repository - Source code and issues
License and DCO
By contributing to Chaos Mesh, you agree that your contributions will be licensed under the Apache License, Version 2.0. All commits must include aSigned-off-by line (use git commit --signoff) to indicate you agree to the Developer Certificate of Origin.