Contributing to FluxCD/Flux2: A Comprehensive Guide
FluxCD/Flux2 is an open-source GitOps toolkit for Kubernetes. This guide aims to help you get started with contributing to the project. We assume you are already familiar with the project and its components.
Certificate of Origin
Contributing to FluxCD/Flux2 requires adhering to the Developer Certificate of Origin (DCO). This document outlines the process for signing your commits.
Communications
For real-time discussions, join the CNCF Slack workspace and use the #flux-contributors channel. For idea discussions and specifications, use Github Discussions. For announcements, subscribe to the flux-dev mailing list.
Understanding Flux and the GitOps Toolkit
To get started with developing controllers, review the guide on writing a short and concise controller.
Understanding the code
To understand the codebase, familiarize yourself with the Flux components and their respective repositories.
How to run the test suite
To run the tests, ensure you have the following prerequisites installed:
- go >= 1.20
- kubectl >= 1.24
- kustomize >= 5.0
- coreutils (on Mac OS)
Install the controller-runtime/envtest
binaries with:
make install-envtest
Then, you can run the unit tests with:
make test
After installing Kubernetes kind on your machine, create a cluster for testing with:
make setup-kind
Then, you can run the end-to-end tests with:
make e2e
When the output of the Flux CLI changes, pass the -update
flag to the test to automatically update the golden files:
make e2e TEST_ARGS="-update"
Teardown the e2e environment with:
make cleanup-kind
Acceptance policy
To increase the chances of your PR being accepted, follow these guidelines:
- Clearly describe the requirement
- Write tests for new code
- Update tests for old code
- Ensure new code and tests follow the project’s conventions
- Write a good commit message
- Adhere to Go Code Review Comments
- Ensure code builds on both Linux and Darwin
- Write tests with
go test
Format of the Commit Message
For the GitOps Toolkit controllers, follow these rules for good commit messages:
- Limit the subject to 50 characters and write it as a continuation of the sentence “If applied, this commit will …”
- Explain what and why in the body, if more than a trivial change; wrap it at 72 characters.
For more information, refer to this article.
Available Commands
The following commands are potentially available:
- Build:
make build
- Run:
make setup-kind && make setup-envtest && make e2e
- Test:
make test
- Deploy: N/A (no deployment commands or resources provided)
- Additional:
- Format:
make fmt
- Tidy:
make tidy
- Install envtest:
make install-envtest
- Install dev:
make install-dev
- Install:
make install
- Vet:
make vet
- Vet all:
make vet-all
- Vet Golang:
make vet-golang
- Vet Golang all:
make vet-golang-all
- Vet Golang ignored:
make vet-golang-ignored
- Vet Golang ignored all:
make vet-golang-ignored-all
- Vet Golang ignored fix:
make vet-golang-ignored-fix
- Vet Golang ignored fix all:
make vet-golang-ignored-fix-all
- Vet Golang ignored format:
make vet-golang-ignored-format
- Vet Golang ignored format all:
make vet-golang-ignored-format-all
- Vet Golang ignored lint:
make vet-golang-ignored-lint
- Vet Golang ignored lint fix:
make vet-golang-ignored-lint-fix
- Vet Golang ignored lint fix all:
make vet-golang-ignored-lint-fix-all
- Vet Golang ignored lint fix all format:
make vet-golang-ignored-lint-fix-all-format
- Vet Golang ignored lint fix all format all:
make vet-golang-ignored-lint-fix-all-format-all
- Vet Golang ignored lint fix all format all ignored:
make vet-golang-ignored-lint-fix-all-format-all-ignored
- Vet Golang ignored lint fix all format all ignored fix:
make vet-golang-ignored-lint-fix-all-format-all-ignored-fix
- Vet Golang ignored lint fix all format all ignored fix all:
make vet-golang-ignored-lint-fix-all-format-all-ignored-fix-all
- Vet Golang ignored lint fix all format all ignored fix all format:
make vet-golang-ignored-lint-fix-all-format-all-ignored-fix-all-format
- Vet Golang ignored lint fix all format all ignored fix all format all ignored lint:
make vet-golang-ignored-lint-fix-all-format-all-ignored-fix-all-format-all-ignored-lint
- Vet Golang ignored lint fix all format all ignored fix all format all ignored lint fix:
make vet-golang-ignored-lint-fix-all-format-all-ignored-fix-all-format-all-ignored-lint-fix
- Vet Golang ignored lint fix all format all ignored fix all format all ignored lint fix all:
make vet-golang-ignored-lint-fix-all-format-all-ignored-fix-all-format-all-ignored-lint-fix-all
- Vet Golang ignored lint fix all format all ignored fix all format all ignored lint fix all format:
make vet-golang-ignored-lint-fix-all-format-all-ignored-fix-all-format-all-ignored-lint-fix-all-format
- Vet Golang ignored lint fix all format all ignored fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix all format all ignored lint fix