Skip to content

Reference: TopicPermission CRD

A TopicPermission restricts which routing keys a RabbitMQ user can publish with, or bind with, on one topic exchange. RabbitMQ checks topic permissions after the regular permissions from a Permission, so the user also needs write or read access to the exchange there.

  • apiVersion: rabbitmq.com/v1beta1
  • kind: TopicPermission
  • Scope: Namespaced

This page documents the RabbitMQ Messaging Topology Operator v1.20.6.

Example

apiVersion: rabbitmq.com/v1beta1
kind: TopicPermission
metadata:
  name: my-app-user-orders-topic
  namespace: your-application-namespace
spec:
  vhost: my-app-vhost
  userReference:
    name: my-app-user
  permissions:
    # The RabbitMQ name of a topic exchange
    exchange: orders
    write: "^orders\\.eu\\..*"
    read: "^orders\\..*"
  rabbitmqClusterReference:
    name: my-rabbitmq-cluster

Specification (spec)

Field Type Description
vhost string Required. The RabbitMQ name of an existing virtual host. You cannot change this field after creation.
userReference object Optional. A reference (name) to a User resource in the same namespace. Set this field or user, but not both. You cannot change this field after creation.
user string Optional. The RabbitMQ username of an existing user. Set this field or userReference, but not both. You cannot change this field after creation.
permissions object Required. The topic exchange and the routing key patterns. See spec.permissions.
rabbitmqClusterReference object Required. The RabbitMQ cluster that holds both the user and the virtual host. You cannot change this field after creation. See spec.rabbitmqClusterReference.

spec.permissions

Field Type Description
exchange string Required. The RabbitMQ name of a topic exchange. You cannot change this field after creation.
write string Optional. A regular expression that the routing key must match when the user publishes to the exchange.
read string Optional. A regular expression that the routing key must match when the user binds a queue to the exchange, which controls what the user can consume.

See RabbitMQ topic authorization.

spec.rabbitmqClusterReference

Identifies the RabbitMQ cluster. Set either name or connectionSecret, but not both.

Field Type Description
name string Optional. The name of the RabbitmqCluster resource. Set this field or connectionSecret.
namespace string Optional. The namespace of the RabbitmqCluster. Defaults to the namespace of the TopicPermission. A cluster in another namespace accepts the reference only if its rabbitmq.com/topology-allowed-namespaces annotation lists your namespace.
connectionSecret object Optional. A reference (name) to a Secret with the keys uri, username and password for the management API of a RabbitMQ cluster that the RabbitMQ Cluster Operator does not manage. The Secret must have the label rabbitmq.com/topology-operator: "true". Set this field or name.

Status (status)

Field Type Description
conditions []object The Ready condition is True with reason SuccessfulCreateOrUpdate when RabbitMQ has the topic permissions, and False with reason FailedCreateOrUpdate and an error message otherwise.
observedGeneration integer The most recent metadata.generation that the operator reconciled.

Platform Notes

  • We provision and manage the RabbitmqCluster resource in your namespace and give you its name. Set spec.rabbitmqClusterReference.name to that name. See Getting Started.

Further Reading