|
| 1 | +# Strimzi Kafka Operator |
| 2 | + |
| 3 | +Strimzi provides a way to run Apache Kafka® clusters on Kubernetes and OpenShift using the Operator pattern. |
| 4 | +It simplifies the deployment and management of Kafka clusters, including topics, users, connectors, and more. |
| 5 | + |
| 6 | +See [README.md](README.md) for project overview, quick starts, and community information. |
| 7 | + |
| 8 | +## Architecture |
| 9 | + |
| 10 | +Multi-module Maven project. |
| 11 | + |
| 12 | +### Requirements |
| 13 | + |
| 14 | +- **Java**: Java 21 |
| 15 | +- **Build tools**: Maven 3.5+, make, bash |
| 16 | +- **Helm**: Helm 3 (for Helm chart packaging and testing) |
| 17 | +- **Container runtime**: Docker or Podman (use `DOCKER_CMD=podman` for Podman) |
| 18 | +- **Kubernetes cluster**: Required for integration/system tests (minikube, kind, or remote cluster) |
| 19 | + |
| 20 | +### Key Dependencies |
| 21 | + |
| 22 | +- Kafka client and Fabric8 Kubernetes client versions: See `pom.xml` |
| 23 | +- Supported Kafka versions (for cluster deployment): See `kafka-versions.yaml` |
| 24 | + |
| 25 | +### Modules |
| 26 | + |
| 27 | +| Module | Purpose | |
| 28 | +|--------|--------------------------------------------------------------------| |
| 29 | +| `cluster-operator/` | Main operator managing Kafka clusters | |
| 30 | +| `topic-operator/` | Manages Kafka topics via KafkaTopic CRs | |
| 31 | +| `user-operator/` | Manages Kafka users and ACLs via KafkaUser CRs | |
| 32 | +| `api/` | CRD definitions and API models (Kafka, KafkaTopic, KafkaUser, etc.) | |
| 33 | +| `operator-common/` | Shared operator code and utilities | |
| 34 | +| `kafka-agent/` | Java agent running inside Kafka containers (broker config, metrics) | |
| 35 | +| `tracing-agent/` | OpenTelemetry tracing support | |
| 36 | +| `certificate-manager/` | TLS certificate management and CA handling | |
| 37 | +| `kafka-init/` | Kafka container initialization logic | |
| 38 | +| `crd-generator/` | Generates CRDs from `api` module via Java annotations | |
| 39 | +| `crd-annotations/` | Annotations for CRD generation | |
| 40 | +| `config-model/` | Kafka configuration models utility classes | |
| 41 | +| `config-model-generator/` | Generates Kafka configuration models | |
| 42 | +| `v1-api-conversion/` | Conversion tool from v1beta2 to v1 CRDs | |
| 43 | +| `mockkube/` | Mock Kubernetes for unit testing | |
| 44 | +| `test/` | Test utilities and helpers | |
| 45 | +| `systemtest/` | End-to-end system tests | |
| 46 | + |
| 47 | +## Contributing |
| 48 | + |
| 49 | +- **Commit sign-off (DCO)** (REQUIRED on all commits): always use `git commit -s` |
| 50 | + - If forgotten: `git commit --amend -s` to fix last commit |
| 51 | + - CI will fail without sign-off |
| 52 | + - More info: [CONTRIBUTING.md](CONTRIBUTING.md) |
| 53 | + |
| 54 | +- **Code style**: Enforced by checkstyle (runs in CI on all PRs) |
| 55 | + - Config: `.checkstyle/checkstyle.xml` |
| 56 | + - Run locally: `mvn checkstyle:check` |
| 57 | + - CI will fail if checkstyle errors are found |
| 58 | + |
| 59 | +## Developer Notes |
| 60 | + |
| 61 | +### Common Development Tasks |
| 62 | + |
| 63 | +**Building:** |
| 64 | +- Build project: `make all` (compiles Java, runs tests, builds Docker images) |
| 65 | +- Clean build artifacts: `make clean` |
| 66 | +- Customize Maven behavior: Use `MVN_ARGS` environment variable |
| 67 | + - Skip all tests: `MVN_ARGS=-DskipTests make all` |
| 68 | + - Skip integration tests only: `MVN_ARGS=-DskipITs make all` |
| 69 | +- Build specific module: Run `make all` or `make clean` from module directory (`MVN_ARGS` works here too) |
| 70 | + |
| 71 | +**Testing:** |
| 72 | +- Unit tests only: `mvn test` |
| 73 | +- Unit + integration tests: `mvn verify` |
| 74 | +- System tests (requires Kubernetes cluster): see [TESTING.md](development-docs/TESTING.md) |
| 75 | + |
| 76 | +**CRD Changes:** If you changed anything in the `api/` module: |
| 77 | +1. Run `make all` in the `api/` module to update generated files |
| 78 | +2. Run `make crd_install` to update derived CRDs in: |
| 79 | + - `api/src/test/resources/crds/` |
| 80 | + - `packaging/install/cluster-operator/` |
| 81 | + - `packaging/helm-charts/helm3/strimzi-kafka-operator/crds/` |
| 82 | + |
| 83 | +**Generated Code** (Never edit directly): |
| 84 | +- Sundrio builders/fluent classes (generated from annotations) |
| 85 | +- Config Model JSONs (generated from Kafka source) |
| 86 | +- Files in `target/` directories or marked `@Generated` |
| 87 | + |
| 88 | +**Container Images:** |
| 89 | +- Built via `docker-images/` Makefiles |
| 90 | +- Base images in `docker-images/base/` |
| 91 | +- Use `DOCKER_CMD=podman` to use Podman instead of Docker |
| 92 | +- Environment variables for custom registry: |
| 93 | + - `DOCKER_ORG`: your registry organization/username (e.g., Docker Hub or Quay.io username, default: `$USER`) |
| 94 | + - `DOCKER_REGISTRY`: registry to use (e.g., `docker.io`, `quay.io`, default: `docker.io`) |
| 95 | + - `DOCKER_TAG`: image tag (default: `latest`) |
| 96 | + - `DOCKER_ARCHITECTURE`: target architecture for container images (e.g., `amd64`, `arm64`) |
| 97 | + |
| 98 | +## Documentation |
| 99 | + |
| 100 | +User-facing documentation is in `documentation/` folder (AsciiDoc format): |
| 101 | +- **Overview guide**: Key concepts and features |
| 102 | +- **Deploying and Managing guide**: Deployment instructions and best practices |
| 103 | +- **API Reference**: Detailed configuration reference |
| 104 | + |
| 105 | +For contributing to documentation, see the documentation related [README.md](documentation/README.md). |
0 commit comments