Contributing¶
Thank you for your interest in contributing to pgop!
Development Setup¶
Prerequisites¶
- Go 1.21+
- Docker
- kubectl
- Access to a Kubernetes cluster (or kind/minikube)
Clone and Build¶
Run Tests¶
Run Locally¶
Making Changes¶
Code Style¶
- Follow standard Go formatting (
go fmt) - Use meaningful variable and function names
- Add comments for exported functions
- Keep functions focused and small
Commit Messages¶
Use conventional commit format:
feat: add support for connection pooling
fix: correct role deletion order
docs: update installation guide
test: add cluster controller tests
Pull Request Process¶
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Make your changes
- Run tests (
make test) - Commit with a descriptive message
- Push and open a Pull Request
Project Structure¶
├── api/v1alpha1/ # CRD type definitions
├── cmd/ # Main entry point
├── config/ # Kustomize manifests
│ ├── crd/ # CRD definitions
│ ├── default/ # Default deployment
│ ├── manager/ # Operator deployment
│ ├── rbac/ # RBAC rules
│ └── samples/ # Example resources
├── docs/ # Documentation
├── internal/
│ ├── controller/ # Reconciliation logic
│ └── postgres/ # PostgreSQL client
└── hack/ # Build scripts
Adding Features¶
New CRD Field¶
- Update type definition in
api/v1alpha1/ - Run
make generate manifests - Update controller logic
- Add tests
- Update documentation
New Controller¶
- Create controller in
internal/controller/ - Register in
cmd/main.go - Add RBAC markers
- Add tests
- Run
make manifests
Testing¶
Unit Tests¶
E2E Tests (coming soon)¶
Reporting Issues¶
- Use GitHub Issues
- Include Kubernetes version
- Include operator logs
- Include resource YAML (sanitized)
License¶
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.