Contributing¶
Thank you for your interest in contributing to the Cloudflare Tunnel Gateway Controller!
Code of Conduct¶
Be respectful and constructive in all interactions. We welcome contributors of all experience levels.
How to Contribute¶
Reporting Issues¶
- Search existing issues before creating a new one
- Use the issue templates for bug reports and feature requests
- Provide as much detail as possible (versions, logs, reproduction steps)
Submitting Pull Requests¶
- Fork the repository
- Create a feature branch from
master - Make your changes
- Ensure tests pass and linting is clean
- Submit a pull request
Development Setup¶
See Setup for detailed instructions.
Quick start:
git clone https://github.com/lexfrei/cloudflare-tunnel-gateway-controller.git
cd cloudflare-tunnel-gateway-controller
go mod download
go build ./...
golangci-lint run
Commit Message Format¶
We use Conventional Commits:
type(scope): brief description
Optional longer explanation.
Co-Authored-By: Your Name <your@email.com>
Types¶
| Type | Description |
|---|---|
feat | New feature |
fix | Bug fix |
docs | Documentation changes |
style | Code style changes (formatting) |
refactor | Code refactoring |
test | Adding or updating tests |
chore | Maintenance tasks |
ci | CI/CD changes |
perf | Performance improvements |
build | Build system changes |
Examples¶
feat(controller): add support for GRPCRoute
fix(ingress): handle empty hostnames correctly
docs(readme): add installation instructions
chore(deps): update controller-runtime to v0.22.4
Pull Request Process¶
- Title: Use conventional commit format
- Description: Fill out the PR template completely
- Tests: Add tests for new functionality
- Linting: Ensure
golangci-lint runpasses with no errors - Documentation: Update relevant docs
- Review: Address reviewer feedback
Testing PR Changes¶
Each PR automatically builds test artifacts. Links to test container images and Helm chart are posted as a comment on the PR, allowing you to test changes before merging.
PR Checklist¶
- Code follows project style guidelines
- Tests added/updated for changes
- Documentation updated
- Commit messages follow conventional format
- All CI checks pass
- PR description is complete
Code Style¶
Go Code¶
- Follow standard Go conventions
- Use
golangci-lintfor linting (config in.golangci.yaml) - Maximum function length: 60 lines
- Maximum cyclomatic complexity: 15
- Add godoc comments to exported types and functions
Linting¶
All linting errors must be fixed before merging:
nolint Directives¶
If you must disable a linter, always provide an explanation:
//nolint:funlen // controller setup requires multiple initialization steps
func Run(ctx context.Context, cfg *Config) error {
Testing¶
Running Tests¶
# All tests
go test -v ./...
# With race detector
go test -race ./...
# With coverage
go test -coverprofile=coverage.out ./...
Helm Chart Tests¶
Test Requirements¶
- Unit tests for new functionality
- Table-driven tests preferred
- Mock external dependencies
- Test error cases
Documentation¶
What to Document¶
- New features in README.md
- API changes in Gateway API docs
- Configuration options
- Breaking changes
Documentation Style¶
- Use clear, concise language
- Include code examples
- Keep formatting consistent with existing docs
Release Process¶
Releases are automated via GitHub Actions:
- Version is determined by commit messages (semantic versioning)
- Container images are built and pushed to GHCR
- Helm chart is published to OCI registry
- GitHub Release is created with changelog
Getting Help¶
- Open an issue for questions
- Check existing documentation in
docs/ - Review closed issues for similar problems
License¶
By contributing, you agree that your contributions will be licensed under the BSD 3-Clause License.