provider-rabbitmq is a Crossplane provider that enables management of RabbitMQ resources through Kubernetes
custom resources. This
provider allows you to manage RabbitMQ resources using Kubernetes-style declarative configurations.
The RabbitMQ provider offers the following features:
- Virtual Hosts: Manage virtual hosts
- Users: Manage users
- Exchanges: Manage exchanges
- Queues: Manage queues
- Bindings: Configure bindings between exchanges and queues
- Permissions: Manage user permissions within virtual hosts
To install the provider, use the following resource definition (replace PROVIDER_VERSION with the desired version):
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-rabbitmq
namespace: crossplane-system
spec:
package: xpkg.upbound.io/pnowy/provider-rabbitmq:PROVIDER_VERSIONThis will install the provider in the crossplane-system namespace and install CRDs and controllers for the provider.
In order to configure the provider deployment runtime config, create a DeploymentRuntimeConfig resource:
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
name: provider-rabbitmq
spec:
deploymentTemplate:
spec:
template:
spec:
tolerations:
- effect: NoSchedule
key: crossplane
operator: Existswhich can be referenced in the provider definition:
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-rabbitmq
namespace: crossplane-system
spec:
package: xpkg.upbound.io/pnowy/provider-rabbitmq:PROVIDER_VERSION
runtimeConfigRef:
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
name: provider-rabbitmqThe provider requires credentials to connect to your RabbitMQ server. Create a Kubernetes secret with your RabbitMQ credentials:
apiVersion: v1
kind: Secret
metadata:
name: rabbitmq-credentials
namespace: crossplane-system
stringData:
credentials: |
{
"username": "guest",
"password": "guest",
"endpoint": "http://rabbitmq.rabbitmq.svc.cluster.local:15672"
}Then create a ProviderConfig (for cluster scope resources):
apiVersion: rabbitmq.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
name: provider-rabbitmq
spec:
credentials:
source: Secret
secretRef:
name: rabbitmq-credentials
namespace: crossplane-system
key: credentials- For each RabbitMQ instance you need one or more
ProviderConfigresources - The
ProviderConfigresource is used to store the RabbitMQ endpoint, username and password details that are required to connect to the RabbitMQ API server
With Crossplane V2 there is a separate group rabbitmq.m.crossplane.io/v1alpha1 and there are ProviderConfig and
ClusterProviderConfig
resources.
See more in crossplane v2 migration section
You can explore the available custom resources:
kubectl get crd | grep rabbitmq.crossplane.ioto list all the CRDs provided by the providerkubectl explain <CRD_NAME>for docs on the CLI- You can also see the CRDs in the
package/crdsdirectory
You will find usage examples in the examples directory.
If you would like to quickstart with the provider you can use make quickstart command.
The method is a Makefile target that sets up a complete development environment for testing and using a RabbitMQ provider for Crossplane.
- Creates a local Kubernetes cluster using Kind (Kubernetes in Docker) named "crossplane-rabbitmq-quickstart"
- Sets up the Kubernetes context to point to the newly created cluster
- Installs Crossplane using Helm in a dedicated "crossplane-system" namespace (a Kubernetes add-on for managing infrastructure resources)
- Installs RabbitMQ using Helm in a dedicated "rabbitmq" namespace
- Installs Provider RabbitMQ:
- Applies the provider specification from
examples/provider/provider.yaml - Applies configuration from
examples/provider/config.yaml
- Applies the provider specification from
This method provides developers with a one-command solution to set up a complete development environment with all necessary components for working with the Crossplane RabbitMQ provider.
As a next step you can apply some examples from the examples/sample directory (e.g. vhost.yaml). To log in into
RabbitMQ admin
console from localhost execute the command: k port-forward svc/rabbitmq 15672:15672 -n rabbitmq and then open http://localhost:15672 in
your browser. Login
with username guest and password guest.
With Crossplane V2 the namespaced resources have been supported. Below you will find the migration guide for the provider.
If you want you can still use cluster scope resources under the existing group rabbitmq.crossplane.io. There is no plan to remove them. If
that's you plan just upgrade provider to new version and all existing resources should work as is.
If you would like to start using namespace scoped resources you have to start using CRDs within rabbitmq.m.crossplane.io group.
There are separate providers:
For namespace scope:
apiVersion: rabbitmq.m.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
name: provider-rabbitmq
namespace: rabbitmq # remember about namespace as this is namespaced object
spec:
credentials:
source: Secret
secretRef:
name: rabbitmq-credentials
namespace: rabbitmq
key: credentialsFor cluster scope:
apiVersion: rabbitmq.m.crossplane.io/v1alpha1
kind: ClusterProviderConfig
metadata:
name: provider-rabbitmq
spec:
credentials:
source: Secret
secretRef:
name: rabbitmq-credentials
namespace: rabbitmq
key: credentialsWith above all resources need to reference provider using extra kind field:
apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1
kind: Queue
metadata:
name: myqueue
namespace: rabbitmq
spec:
forProvider:
vhost: demo
providerConfigRef:
name: provider-rabbitmq
kind: ProviderConfig # this is needed with v2 and `rabbitmq.m.crossplane.io` groupSee more examples in examples/sample directory.
For information on how to contribute to this provider, please see the Development Guide.