Reference: User CRD¶
A User creates a RabbitMQ user in your RabbitMQ cluster. By default, the
RabbitMQ Messaging Topology Operator generates a random username and password
and stores them in a Kubernetes Secret in the same namespace. Your
applications read their credentials from that Secret. A User has no access
to any virtual host until you grant it with a Permission.
apiVersion:rabbitmq.com/v1beta1kind:User- Scope: Namespaced
This page documents the RabbitMQ Messaging Topology Operator v1.20.6.
Example¶
apiVersion: rabbitmq.com/v1beta1
kind: User
metadata:
name: my-app-user
namespace: your-application-namespace
spec:
rabbitmqClusterReference:
# The name of the RabbitmqCluster we provided to you
name: my-rabbitmq-cluster
# Use metadata.name as the RabbitMQ username and generate a password.
# The credentials are stored in the Secret my-app-user-user-credentials.
usernameFromMeta: true
tags:
- management
limits:
connections: 20
channels: 100
Specification (spec)¶
| Field | Type | Description |
|---|---|---|
rabbitmqClusterReference |
object |
Required. The RabbitMQ cluster to create the user in. The cluster must exist. You cannot change this field after creation. See spec.rabbitmqClusterReference. |
usernameFromMeta |
boolean |
Optional. When true, the operator uses metadata.name as the RabbitMQ username and generates a random password. Defaults to false, which generates both a random username and a random password. You cannot combine this field with importCredentialsSecret. |
importCredentialsSecret |
object |
Optional. A reference to an existing Secret that holds the credentials to use instead of generated ones. See spec.importCredentialsSecret. You cannot combine this field with usernameFromMeta. |
tags |
[]string |
Optional. Tags that control the user's access to the RabbitMQ management UI and HTTP API. RabbitMQ defines management, policymaker, monitoring and administrator. Without tags, the user can connect over messaging protocols but cannot perform management actions. |
limits |
object |
Optional. Limits on the number of connections and channels the user can open. See spec.limits. |
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 User. 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. |
spec.importCredentialsSecret¶
| Field | Type | Description |
|---|---|---|
name |
string |
Required. The name of a Secret in the same namespace as the User. |
The referenced Secret must exist before you create the User, and it must
have the label rabbitmq.com/topology-operator: "true". The admission webhook
rejects a User that references a missing or unlabeled Secret. The Secret
must contain these keys in its data:
| Key | Description |
|---|---|
username |
Required. The RabbitMQ username. |
passwordHash |
Optional. The SHA-512 hash of the password. An empty string creates a passwordless user. See RabbitMQ password hashing. |
password |
Optional. The plain-text password. The operator uses it only when passwordHash is absent. |
A Secret that contains only username is rejected. The operator watches the
Secret and updates the user's password in RabbitMQ when password or
passwordHash changes, so you rotate the password by updating the Secret.
The operator does not create a <name>-user-credentials Secret for an
imported user.
spec.limits¶
| Field | Type | Description |
|---|---|---|
connections |
integer |
Optional. The maximum number of connections the user can open. |
channels |
integer |
Optional. The maximum number of AMQP 0.9.1 channels the user can open. |
See RabbitMQ user limits.
Generated Credentials¶
When you do not set importCredentialsSecret, the operator creates a Secret
named <metadata.name>-user-credentials in the namespace of the User. It
contains the keys username and password. The User owns the Secret, so
Kubernetes deletes it when you delete the User.
Do not delete this Secret while the User exists. If the operator has to
recreate it, it generates new credentials and existing clients stop working.
Status (status)¶
| Field | Type | Description |
|---|---|---|
username |
string |
The username of the user in RabbitMQ. Use this to find the user in the management UI. |
credentials.name |
string |
The name of the Secret that holds the credentials. This is <metadata.name>-user-credentials, or the importCredentialsSecret name for imported users. |
conditions |
[]object |
The Ready condition is True with reason SuccessfulCreateOrUpdate when the user exists in RabbitMQ, and False with reason FailedCreateOrUpdate and an error message otherwise. Imported users also report a PasswordSynced condition. |
observedGeneration |
integer |
The most recent metadata.generation that the operator reconciled. |
Platform Notes¶
- We provision and manage the
RabbitmqClusterresource in your namespace and give you its name. Setspec.rabbitmqClusterReference.nameto that name. See Getting Started. - You manage
Userresources yourself, in your GitOps repository.