Skip to content

Commit

Permalink
Add CRD descriptions on fields that cannot be updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunyiLyu committed May 14, 2021
1 parent 32e61dc commit 82b439a
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 26 deletions.
7 changes: 6 additions & 1 deletion api/v1beta1/binding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@ import (

// BindingSpec defines the desired state of Binding
type BindingSpec struct {
// Default to vhost '/'
// Default to vhost '/'; cannot be updated
// +kubebuilder:default:=/
Vhost string `json:"vhost,omitempty"`
// Cannot be updated
// +kubebuilder:validation:Optional
Source string `json:"source,omitempty"`
// Cannot be updated
// +kubebuilder:validation:Optional
Destination string `json:"destination,omitempty"`
// Cannot be updated
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Enum=exchange;queue
DestinationType string `json:"destinationType,omitempty"`
// Cannot be updated
// +kubebuilder:validation:Optional
RoutingKey string `json:"routingKey,omitempty"`
// Cannot be updated
// +kubebuilder:validation:Type=object
// +kubebuilder:pruning:PreserveUnknownFields
Arguments *runtime.RawExtension `json:"arguments,omitempty"`
Expand Down
6 changes: 5 additions & 1 deletion api/v1beta1/exchange_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ import (

// ExchangeSpec defines the desired state of Exchange
type ExchangeSpec struct {
// Required property; cannot be updated
// +kubebuilder:validation:Required
Name string `json:"name"`
// Default to vhost '/'
// Default to vhost '/'; cannot be updated
// +kubebuilder:default:=/
Vhost string `json:"vhost,omitempty"`
// Cannot be updated
// +kubebuilder:validation:Enum=direct;fanout;headers;topic
// +kubebuilder:default:=direct
Type string `json:"type,omitempty"`
// Cannot be updated
Durable bool `json:"durable,omitempty"`
// Cannot be updated
AutoDelete bool `json:"autoDelete,omitempty"`
// +kubebuilder:validation:Type=object
// +kubebuilder:pruning:PreserveUnknownFields
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/permission_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (

// PermissionSpec defines the desired state of Permission
type PermissionSpec struct {
// Name of an existing user; required property.
// Name of an existing user; required property; cannot be updated
// +kubebuilder:validation:Required
User string `json:"user"`
// Name of an existing vhost; required property.
// Name of an existing vhost; required property; cannot be updated
// +kubebuilder:validation:Required
Vhost string `json:"vhost"`
// Permissions to grant to the user in the specific vhost; required property.
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/policy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
// PolicySpec defines the desired state of Policy
// https://www.rabbitmq.com/parameters.html#policies
type PolicySpec struct {
// Required property; cannot be updated
// +kubebuilder:validation:Required
Name string `json:"name"`
// Default to vhost '/'
// Default to vhost '/'; cannot be updated
// +kubebuilder:default:=/
Vhost string `json:"vhost,omitempty"`
// Regular expression pattern used to match queues and exchanges, e.g. "^amq.".
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/queue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type QueueSpec struct {
}

type RabbitmqClusterReference struct {
// Cannot be updated
// +kubebuilder:validation:Required
Name string `json:"name"`
}
Expand Down
8 changes: 7 additions & 1 deletion config/crd/bases/rabbitmq.com_bindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ spec:
description: BindingSpec defines the desired state of Binding
properties:
arguments:
description: Cannot be updated
type: object
x-kubernetes-preserve-unknown-fields: true
destination:
description: Cannot be updated
type: string
destinationType:
description: Cannot be updated
enum:
- exchange
- queue
Expand All @@ -53,17 +56,20 @@ spec:
be created in. Required property.
properties:
name:
description: Cannot be updated
type: string
required:
- name
type: object
routingKey:
description: Cannot be updated
type: string
source:
description: Cannot be updated
type: string
vhost:
default: /
description: Default to vhost '/'
description: Default to vhost '/'; cannot be updated
type: string
required:
- rabbitmqClusterReference
Expand Down
7 changes: 6 additions & 1 deletion config/crd/bases/rabbitmq.com_exchanges.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,27 @@ spec:
type: object
x-kubernetes-preserve-unknown-fields: true
autoDelete:
description: Cannot be updated
type: boolean
durable:
description: Cannot be updated
type: boolean
name:
description: Required property; cannot be updated
type: string
rabbitmqClusterReference:
description: Reference to the RabbitmqCluster that the exchange will
be created in. Required property.
properties:
name:
description: Cannot be updated
type: string
required:
- name
type: object
type:
default: direct
description: Cannot be updated
enum:
- direct
- fanout
Expand All @@ -66,7 +71,7 @@ spec:
type: string
vhost:
default: /
description: Default to vhost '/'
description: Default to vhost '/'; cannot be updated
type: string
required:
- name
Expand Down
7 changes: 5 additions & 2 deletions config/crd/bases/rabbitmq.com_permissions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,18 @@ spec:
user and vhost are. Required property.
properties:
name:
description: Cannot be updated
type: string
required:
- name
type: object
user:
description: Name of an existing user; required property.
description: Name of an existing user; required property; cannot be
updated
type: string
vhost:
description: Name of an existing vhost; required property.
description: Name of an existing vhost; required property; cannot
be updated
type: string
required:
- permissions
Expand Down
4 changes: 3 additions & 1 deletion config/crd/bases/rabbitmq.com_policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ spec:
type: object
x-kubernetes-preserve-unknown-fields: true
name:
description: Required property; cannot be updated
type: string
pattern:
description: Regular expression pattern used to match queues and exchanges,
Expand All @@ -68,13 +69,14 @@ spec:
be created in. Required property.
properties:
name:
description: Cannot be updated
type: string
required:
- name
type: object
vhost:
default: /
description: Default to vhost '/'
description: Default to vhost '/'; cannot be updated
type: string
required:
- definition
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/rabbitmq.com_queues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ spec:
be created in. Required property.
properties:
name:
description: Cannot be updated
type: string
required:
- name
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/rabbitmq.com_schemareplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ spec:
would be set for. Must be an existing cluster.
properties:
name:
description: Cannot be updated
type: string
required:
- name
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/rabbitmq.com_users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ spec:
created for. This cluster must exist for the User object to be created.
properties:
name:
description: Cannot be updated
type: string
required:
- name
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/rabbitmq.com_vhosts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ spec:
be created in. Required property.
properties:
name:
description: Cannot be updated
type: string
required:
- name
Expand Down
32 changes: 16 additions & 16 deletions docs/api/rabbitmq.com.ref.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ BindingSpec defines the desired state of Binding
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`vhost`* __string__ | Default to vhost '/'
| *`source`* __string__ |
| *`destination`* __string__ |
| *`destinationType`* __string__ |
| *`routingKey`* __string__ |
| *`arguments`* __RawExtension__ |
| *`vhost`* __string__ | Default to vhost '/'; cannot be updated
| *`source`* __string__ | Cannot be updated
| *`destination`* __string__ | Cannot be updated
| *`destinationType`* __string__ | Cannot be updated
| *`routingKey`* __string__ | Cannot be updated
| *`arguments`* __RawExtension__ | Cannot be updated
| *`rabbitmqClusterReference`* __xref:{anchor_prefix}-github-com-rabbitmq-messaging-topology-operator-api-v1beta1-rabbitmqclusterreference[$$RabbitmqClusterReference$$]__ | Reference to the RabbitmqCluster that the binding will be created in. Required property.
|===

Expand Down Expand Up @@ -212,11 +212,11 @@ ExchangeSpec defines the desired state of Exchange
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`name`* __string__ |
| *`vhost`* __string__ | Default to vhost '/'
| *`type`* __string__ |
| *`durable`* __boolean__ |
| *`autoDelete`* __boolean__ |
| *`name`* __string__ | Required property; cannot be updated
| *`vhost`* __string__ | Default to vhost '/'; cannot be updated
| *`type`* __string__ | Cannot be updated
| *`durable`* __boolean__ | Cannot be updated
| *`autoDelete`* __boolean__ | Cannot be updated
| *`arguments`* __xref:{anchor_prefix}-k8s-io-apimachinery-pkg-runtime-rawextension[$$RawExtension$$]__ |
| *`rabbitmqClusterReference`* __xref:{anchor_prefix}-github-com-rabbitmq-messaging-topology-operator-api-v1beta1-rabbitmqclusterreference[$$RabbitmqClusterReference$$]__ | Reference to the RabbitmqCluster that the exchange will be created in. Required property.
|===
Expand Down Expand Up @@ -295,8 +295,8 @@ PermissionSpec defines the desired state of Permission
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`user`* __string__ | Name of an existing user; required property.
| *`vhost`* __string__ | Name of an existing vhost; required property.
| *`user`* __string__ | Name of an existing user; required property; cannot be updated
| *`vhost`* __string__ | Name of an existing vhost; required property; cannot be updated
| *`permissions`* __xref:{anchor_prefix}-github-com-rabbitmq-messaging-topology-operator-api-v1beta1-vhostpermissions[$$VhostPermissions$$]__ | Permissions to grant to the user in the specific vhost; required property. See RabbitMQ doc for more information: https://www.rabbitmq.com/access-control.html#user-management
| *`rabbitmqClusterReference`* __xref:{anchor_prefix}-github-com-rabbitmq-messaging-topology-operator-api-v1beta1-rabbitmqclusterreference[$$RabbitmqClusterReference$$]__ | Reference to the RabbitmqCluster that both the provided user and vhost are. Required property.
|===
Expand Down Expand Up @@ -375,8 +375,8 @@ PolicySpec defines the desired state of Policy https://www.rabbitmq.com/paramete
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`name`* __string__ |
| *`vhost`* __string__ | Default to vhost '/'
| *`name`* __string__ | Required property; cannot be updated
| *`vhost`* __string__ | Default to vhost '/'; cannot be updated
| *`pattern`* __string__ | Regular expression pattern used to match queues and exchanges, e.g. "^amq.". Required property.
| *`applyTo`* __string__ | What this policy applies to: 'queues', 'exchanges', or 'all'. Default to 'all'.
| *`priority`* __integer__ | Default to '0'. In the event that more than one policy can match a given exchange or queue, the policy with the greatest priority applies.
Expand Down Expand Up @@ -506,7 +506,7 @@ QueueStatus defines the observed state of Queue
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`name`* __string__ |
| *`name`* __string__ | Cannot be updated
|===


Expand Down

0 comments on commit 82b439a

Please sign in to comment.