How rabbitmq/cluster-operator works
Project type and purpose
• This is a Kubernetes Operator written in Go, specifically the RabbitMQ Cluster Kubernetes Operator.
• Its purpose is to provide a custom controller plus CRD definitions to manage the full lifecycle (create, scale, upgrade, shutdown) of RabbitMQ clusters running on Kubernetes.
File structure
• Top-level directories:
• api/v1beta1: CRD schema and generated code for RabbitMQCluster custom resource
• controllers: reconciliation logic broken into multiple Go source files (each handling part of the resource lifecycle)
• config: kustomize overlays for CRD installation, RBAC, manager Deployment, namespace, samples, and installation
• internal: helper packages (metadata, resource builders, scaling, status, promtool, etc.)
• observability: Grafana dashboards, Prometheus rules and monitors for metrics collection and alerting
• olm: Operator Lifecycle Manager (OLM) bundle, assets, templates, tests
• bin: a Kubectl plugin (“kubectl-rabbitmq”) and its tests
• pkg: profiling support (pprof)
• hack, scripts: utility scripts for code generation, notices, version printing, testing
• system_tests, olm/test: E2E and integration tests
• Configuration files:
• Dockerfile, Makefile, PROJECT: build and metadata
• .github/workflows and dependabot, release pipelines
• go.mod, go.sum: module dependencies
README for additional insights
• The operator installs via applying bundled YAML (CRDs + Deployment + RBAC)
• Relies on controller-runtime from Kubernetes SIGs
• Integrates with Prometheus/Alertmanager and Grafana via ServiceMonitor/PodMonitor, dashboards
• Supports non-strict semver and OLM packaging