Contributing
We welcome contributions to Kaniop! This guide will help you get started with development and contributing to the project.
Development Environment Setup
Prerequisites
- Rust: Install the latest stable Rust toolchain
- Kubernetes: Access to a Kubernetes cluster (kind, minikube, or remote)
- kubectl: Kubernetes command-line tool
- Helm: Package manager for Kubernetes
- Docker: For building container images
Getting Started
-
Fork and Clone
git clone https://github.com/<your-username>/kaniop.git cd kaniop -
Install Rust Toolchain
rustup toolchain install stable rustup default stable rustup component add rustfmt clippy -
Build the Project
make build make test
Code Generation
Kaniop uses code generation for CRDs and examples:
Generate CRDs
make crdgen
Generate Examples
make examples
Testing
Unit Tests
make test
Integration Tests
Integration tests require a running Kubernetes cluster:
make integration-test
End-to-End Tests
Full E2E tests including Kanidm deployment:
make e2e-test
Contribution Guidelines
Pull Request Process
-
Create a Feature Branch
git checkout -b feature/your-feature-name -
Make Your Changes
- Write tests for new functionality
- Update documentation as needed
- Follow existing code style
-
Test Your Changes
make test make lint -
Commit and Push
git commit -m "feat: add new feature description" git push origin feature/your-feature-name
Follow Conventional Commits format.
Documentation
Book Documentation
Preview the documentation book:
make book
Coding Standards
Code Formatting
Use rustfmt for all code (automatic via make lint). See rustfmt.yaml
Code Organization
-
Imports: Always at the top level, grouped by origin:
// Crate imports use crate::crd::KanidmPerson; // Internal crates use kaniop_operator::reconcile; // Standard library use std::collections::HashMap; use std::sync::Arc; // External crates use anyhow::Context; use kube::Client; -
Never inline imports: Don’t add
usestatements inside functions or impl blocks
Clippy
All clippy warnings must be resolved:
make lint
We use #![deny(warnings)] in CI, so your code must be warning-free.
Dependencies
- Minimize dependencies: Only add if no internal equivalent exists
- Shared dependencies: Add to
[workspace.dependencies]in rootCargo.toml - Version pinning: Use specific versions for reproducible builds
- Security: We regularly update dependencies via Renovate
Testing
Test Strategy
- Unit Tests: Test individual functions and modules
- Integration Tests: Test interaction with external services (Tempo tracing)
- E2E Tests: Main way to test, it tests full operator behavior in Kind cluster
Community
Keep docs in sync with code changes and CRD definitions.
Community
- GitHub Issues: Report bugs or request features
- GitHub Discussions: Ask questions and discuss ideas
Thank you for contributing to Kaniop!