Contributing to VirtRigaud¶
Thank you for your interest in contributing to VirtRigaud! This document provides guidelines and information for contributors.
Development Setup¶
Prerequisites¶
- Go 1.23+
- Docker
- Kubernetes cluster (kind, k3s, or remote)
- kubectl
- Helm 3.x
- make
Clone and Setup¶
git clone https://github.com/projectbeskar/virtrigaud.git
cd virtrigaud
# Install development dependencies
make dev-setup
# Install pre-commit hooks (optional but recommended)
pip install pre-commit
pre-commit install
Development Workflow¶
1. Making Changes¶
API Changes¶
When modifying API types:
# Edit API types
vim api/infra.virtrigaud.io/v1beta1/virtualmachine_types.go
# Generate code and sync CRDs
make generate
make sync-helm-crds
# Verify everything is in sync
make verify-helm-crds
Code Changes¶
For other code changes:
2. CRD Management¶
Important: Always keep CRDs synchronized between config/crd/bases/ and charts/virtrigaud/crds/.
# After API changes, sync CRDs to Helm chart
make sync-helm-crds
# Verify sync before committing
make verify-helm-crds
3. Testing¶
# Unit tests
make test
# Integration tests (requires cluster)
make test-integration
# End-to-end tests
make test-e2e
# Test specific provider
make test-provider-vsphere
See Testing Locally for more details.
4. Local Development¶
# Deploy to local cluster
make dev-deploy
# Watch for changes and auto-reload
make dev-watch
# Clean up
make dev-clean
Contribution Guidelines¶
Pull Request Process¶
- Fork and branch: Create a feature branch from
main - Make changes: Follow the development workflow above
- Test thoroughly: Run all relevant tests
- Update docs: Update documentation if needed
- CRD sync: Ensure CRDs are synchronized (CI will verify)
- Submit PR: Create a pull request with clear description
PR Requirements¶
- All tests pass
- CRDs are in sync (verified by CI)
- Code is formatted (
make fmt) - Code is linted (
make lint) - Documentation updated if needed
- Changelog entry added (for user-facing changes)
Commit Message Format¶
Use conventional commit format:
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changesrefactor: Code refactoringtest: Test changeschore: Maintenance tasks
Examples:
feat(vsphere): add graceful shutdown support
fix(crd): resolve powerState validation conflict
docs(upgrade): add CRD synchronization guide
Code Style¶
Go Code¶
- Follow standard Go conventions
- Use
gofmtandgolangci-lint - Add meaningful comments for exported functions
- Include unit tests for new functionality
YAML/Kubernetes¶
- Use 2-space indentation
- Follow Kubernetes API conventions
- Add descriptions to CRD fields
- Include examples in documentation
Documentation¶
- Use clear, concise language
- Include code examples
- Update both API docs and user guides
- Test documentation examples
Testing¶
Unit Tests¶
# Run all unit tests
make test
# Run tests for specific package
go test ./internal/controller/...
# Run with coverage
make test-coverage
Integration Tests¶
Provider Tests¶
# Test specific provider (requires infrastructure)
make test-provider-vsphere
make test-provider-libvirt
make test-provider-proxmox
Release Process¶
For Maintainers¶
-
Prepare release:
-
Create release:
-
CI handles:
- Building and pushing images
- Creating GitHub release
- Publishing Helm charts
- Generating CLI binaries
Common Issues¶
CRD Sync Issues¶
If you see "Helm chart CRDs are out of sync":
Test Failures¶
# Clean and retry
make clean
make test
# For libvirt-related failures
export SKIP_LIBVIRT_TESTS=true
make test
Development Environment¶
# Reset development environment
make dev-clean
make dev-deploy
# Check logs
kubectl logs -n virtrigaud-system deployment/virtrigaud-manager
Documentation Contributions¶
We welcome documentation improvements! To contribute to the documentation:
Documentation Repository¶
The documentation lives in a separate repository:
Making Documentation Changes¶
-
Install dependencies:
-
Make your changes in the
src/directory -
Preview locally:
-
Submit a pull request
See Building Locally for more details on documentation development.
Getting Help¶
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - Questions and community support
- Slack Channel - Real-time chat
- Documentation - Comprehensive guides
Code of Conduct¶
VirtRigaud follows the CNCF Code of Conduct. Please be respectful and inclusive in all interactions.
Recognition¶
Contributors are recognized in:
- CHANGELOG.md for significant contributions
- README.md contributors section
- GitHub contributor graphs
- Release notes
Thank you for contributing to VirtRigaud! 🚀