Go 1.23.0+
Docker
Kubernetes cluster (or kind/minikube for local development)
kubectl configured
Clone the repository
Install dependencies: go mod tidy
Install development tools: make install-tools
Run tests: make test
Run locally: make run
Follow standard Go formatting (gofmt)
Use meaningful variable and function names
Add godoc comments for public functions and types
Handle errors explicitly
Use structured logging with context
Kubernetes Controller Guidelines
Follow controller-runtime patterns
Use proper RBAC annotations
Implement finalizers for cleanup
Use structured logging with request context
Handle not-found errors appropriately
Write unit tests for business logic
Add integration tests for controller behavior
Use Ginkgo/Gomega for consistent test structure
Test both success and error scenarios
Create a feature branch from main
Make your changes
Run make to generate code and run tests
Test locally with make run
Create pull request
Modify types in api/v1/mynginx_types.go
Run make to regenerate code
Update controller logic if needed
Add/update tests
Update documentation
Design the feature (consider CRD changes, controller logic, tests)
Update the CRD schema if needed
Implement controller changes
Add proper RBAC permissions
Write tests
Update documentation
mynginx-controller/
├── api/v1/ # API definitions
├── cmd/ # Application entrypoints
├── config/ # Deployment configurations
├── internal/controller/ # Controller implementation
├── test/ # Test files
├── hack/ # Development scripts
└── Makefile # Build automation
make test # Run unit tests
make test-e2e # Run end-to-end tests
make envtest # Set up test environment
make build # Build binary
make docker-build # Build container image
make deploy # Deploy to cluster
make undeploy # Remove from cluster
make run ARGS=" --log-level=debug" # Run with debug logging
kubectl logs -f deployment/mynginx-controller-manager -n mynginx-controller-system
PR Description Should Include
What changes were made
Why the changes were needed
How to test the changes
Any breaking changes
Related issues/tickets
Update version in relevant files
Update CHANGELOG.md
Create release branch
Test thoroughly
Tag release
Build and push container image
Create GitHub release
Check existing documentation in /docs
Look at similar implementations in controller-runtime examples
Ask questions in issues or discussions
Check Kubernetes Slack channels for controller-runtime help