Skip to content

Commit

Permalink
Update UserSpec documentation
Browse files Browse the repository at this point in the history
Describe the new structure of the `importCredentialsSecret` field
  • Loading branch information
NikSays committed Sep 23, 2024
1 parent 58d496c commit 138c602
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
15 changes: 9 additions & 6 deletions api/v1beta1/user_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ type UserSpec struct {
// exist for the User object to be created.
// +kubebuilder:validation:Required
RabbitmqClusterReference RabbitmqClusterReference `json:"rabbitmqClusterReference"`
// Defines a Secret used to pre-define the username and password set for this User. User objects created
// with this field set will not have randomly-generated credentials, and will instead import
// the username/password values from this Secret.
// The Secret must contain the keys `username` and `password` in its Data field, or the import will fail.
// Note that this import only occurs at creation time, and is ignored once a password has been set
// on a User.
// Defines a Secret containing the credentials for the User. If this field is omitted, random a username and
// password will be generated. The Secret must have the following keys in its Data field:
//
// * `username` – Must be present or the import will fail.
// * `passwordHash` – The SHA-512 hash of the password. If the hash is an empty string, a passwordless user
// will be created. For more information, see https://www.rabbitmq.com/docs/passwords.
// * `password` – Plain-text password. Will be used only if the `passwordHash` key is missing.
//
// Note that this import only occurs at creation time, and is ignored once a password has been set on a User.
ImportCredentialsSecret *corev1.LocalObjectReference `json:"importCredentialsSecret,omitempty"`
}

Expand Down
17 changes: 11 additions & 6 deletions config/crd/bases/rabbitmq.com_users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ spec:
properties:
importCredentialsSecret:
description: |-
Defines a Secret used to pre-define the username and password set for this User. User objects created
with this field set will not have randomly-generated credentials, and will instead import
the username/password values from this Secret.
The Secret must contain the keys `username` and `password` in its Data field, or the import will fail.
Note that this import only occurs at creation time, and is ignored once a password has been set
on a User.
Defines a Secret containing the credentials for the User. If this field is omitted, random a username and
password will be generated. The Secret must have the following keys in its Data field:
* `username` – Must be present or the import will fail.
* `passwordHash` – The SHA-512 hash of the password. If the hash is an empty string, a passwordless user
will be created. For more information, see https://www.rabbitmq.com/docs/passwords.
* `password` – Plain-text password. Will be used only if the `passwordHash` key is missing.
Note that this import only occurs at creation time, and is ignored once a password has been set on a User.
properties:
name:
default: ""
Expand Down
17 changes: 11 additions & 6 deletions docs/api/rabbitmq.com.ref.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1411,12 +1411,17 @@ but cannot perform any management actions.
For more information, see https://www.rabbitmq.com/management.html#permissions.
| *`rabbitmqClusterReference`* __xref:{anchor_prefix}-github-com-rabbitmq-messaging-topology-operator-api-v1beta1-rabbitmqclusterreference[$$RabbitmqClusterReference$$]__ | Reference to the RabbitmqCluster that the user will be created for. This cluster must
exist for the User object to be created.
| *`importCredentialsSecret`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#localobjectreference-v1-core[$$LocalObjectReference$$]__ | Defines a Secret used to pre-define the username and password set for this User. User objects created
with this field set will not have randomly-generated credentials, and will instead import
the username/password values from this Secret.
The Secret must contain the keys `username` and `password` in its Data field, or the import will fail.
Note that this import only occurs at creation time, and is ignored once a password has been set
on a User.
| *`importCredentialsSecret`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#localobjectreference-v1-core[$$LocalObjectReference$$]__ | Defines a Secret containing the credentials for the User. If this field is omitted, random a username and
password will be generated. The Secret must have the following keys in its Data field:


* `username` – Must be present or the import will fail.
* `passwordHash` – The SHA-512 hash of the password. If the hash is an empty string, a passwordless user
will be created. For more information, see https://www.rabbitmq.com/docs/passwords.
* `password` – Plain-text password. Will be used only if the `passwordHash` key is missing.


Note that this import only occurs at creation time, and is ignored once a password has been set on a User.
|===


Expand Down

0 comments on commit 138c602

Please sign in to comment.