Skip to main content

Contributing to PDB Operator

Thank you for your interest in contributing! This guide covers everything you need to get started.

Developer Certificate of Origin (DCO)

This project uses the Developer Certificate of Origin (DCO). All commit messages must contain the Signed-off-by line:

git commit -s -m "feat: add new feature"

If you forget, amend your last commit:

git commit --amend -s

Prerequisites

  • Go 1.26+
  • Docker or Podman
  • kubectl
  • operator-sdk v1.42+
  • A Kubernetes cluster (kind, minikube, or remote)
  • cert-manager (for webhook TLS)

Development Setup

  1. Fork and clone the repository:
git clone https://github.com/<your-username>/pdb-operator.git
cd pdb-operator
  1. Install dependencies and run tests:
go mod tidy
make test
make lint
  1. Build the operator:
make build

Local Development with Kind

# Create a local cluster
make kind-create

# Build and load the image
make docker-build kind-load-images

# Deploy the operator
make deploy

Making Changes

Branching

  • Create a feature branch from main
  • Use descriptive names: feat/add-policy-validation, fix/pdb-reconciliation-race

Coding Standards

  • Follow standard Go conventions
  • Run make lint before submitting
  • Add tests for new functionality
  • Update documentation for user-facing changes

Commit Messages

Follow Conventional Commits:

  • feat: new feature
  • fix: bug fix
  • docs: documentation changes
  • test: adding or updating tests
  • refactor: code refactoring
  • chore: maintenance tasks

Pull Request Process

  1. Ensure all tests pass: make test
  2. Ensure linter passes: make lint
  3. Update relevant documentation
  4. Sign off all commits (DCO)
  5. Open a PR against main
  6. Fill in the PR template
  7. Wait for review from a maintainer

Running Tests

# Unit tests
make test

# End-to-end tests (requires a running cluster)
make test-e2e

# Coverage report
make test COVERPROFILE=coverage.out
go tool cover -html=coverage.out

Reporting Issues

Code of Conduct

This project follows the CNCF Code of Conduct.