Thank you for your interest in contributing! This document provides guidelines for submitting changes to the Cluster Logging Operator project.
-
Fork and Clone
git clone https://github.com/yourusername/cluster-logging-operator.git cd cluster-logging-operator -
Install Dependencies
make tools
-
Create a Branch
git checkout -b feature/your-feature-name
- Check existing issues and the LOG Jira project to avoid duplicate work
- For significant changes, open a Jira issue or GitHub issue to discuss the approach first
- Review the ARCHITECTURE.md to understand the design
-
Write Your Code
- Follow Go conventions and style guidelines
- Keep changes focused and minimal
- Add tests for new functionality
-
Run Tests Locally
# Unit tests make test-unit # All validation make check # Functional tests (requires cluster) make test-functional # E2E tests (requires cluster) make test-e2e-local
-
Code Quality Checks
# Run pre-commit validation make pre-commit # Run linter make lint
-
PR Title and Description
- Use clear, descriptive titles
- Start with the Jira issue number if applicable (e.g., "LOG-1234: Add feature X")
- Provide context on what the change does and why it's needed
-
Code Changes
- Keep PRs focused on a single feature or bug fix
- Update related documentation
- Include tests for new functionality
- Ensure all tests pass locally before pushing
-
Commit Messages
- Use clear, descriptive commit messages
- Reference related issues when applicable
- Keep commits atomic and logical
The repository uses automated CI/CD:
- Unit Tests - Run on every PR
- Linting - Code style validation
- Build Validation - Ensures code compiles
- Functional Tests - Tests component integration
- E2E Tests - Tests full operator functionality in a cluster
All checks must pass before merging. Don't be discouraged if CI catches issues—this is normal. Push fixes and the CI will re-run automatically.
- A maintainer will review your PR
- Address feedback and push updates as needed
- Be patient—reviews may take time due to other priorities
- For urgent changes, mention it in the PR description
Unit tests are required for:
- New API types and validations
- Configuration generation logic
- Controller reconciliation logic
Run with:
make test-unitFunctional tests verify output connector integration (requires cluster):
make test-functionalEnd-to-end tests require a Kubernetes cluster:
make test-e2e-local- Follow Go Code Review Comments
- Use
gofmtfor formatting - Run
make lintbefore committing
When modifying CRD types in api/:
- Update the struct tags and comments
- Run
make generateto update generated code - Run
make bundle docsto update bundle manifests and documentation - Add tests for validation logic
- Update relevant documentation
When adding new output types:
- Add type definition to
api/observability/v1/output_types.go - Add struct definitions to
internal/generator/vector/api/(sinks, sources, transforms as needed) - Create generator in
internal/generator/vector/output/[type]/ - Add entry point to
internal/generator/vector/outputs.go - Add functional tests in
test/functional/outputs/
See docs/contributing/how-to-add-new-output.md for detailed examples.
Comprehensive guide: How to Add a New Output Type
Quick summary:
- Add API type definitions
- Add struct definitions and implement configuration generation
- Add functional tests to verify connectivity and log forwarding
- Update documentation
- New features should include documentation
- API changes need corresponding doc updates
- Complex logic should have implementation notes
- Architecture changes should be documented in ARCHITECTURE.md
- User Guides:
/docs/administration/ - Developer Guides:
/docs/contributing/ - Architecture:
/docs/architecture/ - Feature Docs:
/docs/features/ - API Reference:
/docs/reference/
For navigation tips, see ARCHITECTURE.md.
- Unit tests fail: Check for linting errors with
make lint - Functional tests fail: Verify cluster connectivity and required permissions
- E2E tests fail: Ensure clean cluster state with
make undeploy-all
- Run
make cleanthenmake buildto start fresh - Ensure Go version matches what is specified in
go.mod - Check that all dependencies are installed:
make tools
This project works with:
- GoLand / IntelliJ IDEA with Go plugin
- VS Code with Go extension
- Vim/Neovim with gopls
Run the operator in debug mode:
make run-debugThis starts the operator under the dlv debugger.
When reporting bugs:
- Search existing issues first
- Provide:
- Steps to reproduce
- Expected vs actual behavior
- OpenShift version
- CLO version
- Relevant logs or error messages
See docs/contributing/REVIEW.adoc for detailed review guidelines.
By contributing, you agree that your contributions will be licensed under the Apache License 2.0. See LICENSE for details.