-
Notifications
You must be signed in to change notification settings - Fork 78
Add SuperStream and SuperStreamConsumer CRD #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe these are by design, but noted them here for potential improvement if possible.
superStreamReferencecan be updated
To reproduce, create all objects from messaging-topology-operator/docs/examples/singleactiveconsumer
After objects are all created, modify spec.superstreamConsumerReference.name to something else and apply. Update goes through (there are unit tests to prevent this update if I'm not mistaken).
- Orders in list
spec.routingKeysmatters when comparing the updated list with the current list.
Create superstream.rabbitmq.com/orders from the example with less than 3 routingKeys defined, swatch the position of a pair of keys and update will fail with Resource: "rabbitmq.com/v1beta1, Resource=superstreams", GroupVersionKind: "rabbitmq.com/v1beta1, Kind=SuperStream" Name: "orders", Namespace: "rabbitmq-system" for: "superstream.yaml": admission webhook "vsuperstream.kb.io" denied the request: SuperStream.rabbitmq.com "orders" is forbidden: spec.routingKeys: Forbidden: updates may only add to the existing list of routing keys
| // +kubebuilder:rbac:groups=rabbitmq.com,resources=exchanges,verbs=get;create;update;patch;delete | ||
| // +kubebuilder:rbac:groups=rabbitmq.com,resources=queues,verbs=get;create;update;patch;delete | ||
| // +kubebuilder:rbac:groups=rabbitmq.com,resources=bindings,verbs=get;create;update;patch;delete | ||
| // +kubebuilder:rbac:groups=rabbitmq.com,resources=superstreams,verbs=get;list;watch;create;update;patch;delete | ||
| // +kubebuilder:rbac:groups=rabbitmq.com,resources=superstreams/status,verbs=get;update;patch | ||
| // +kubebuilder:rbac:groups=rabbitmq.com,resources=rabbitmqclusters,verbs=get;list;watch | ||
| // +kubebuilder:rbac:groups=rabbitmq.com,resources=rabbitmqclusters/status,verbs=get | ||
| // +kubebuilder:rbac:groups="",resources=services,verbs=get;list;watch | ||
| // +kubebuilder:rbac:groups="",resources=events,verbs=get;create;patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most of these are defined in other controllers already. I suggest only define the ones that's new to this controller.
|
@ChunyiLyu Thanks for the review! On your points: 1: Totally agree, that field should be immutable IMO. I can see how that provides a confusing API, though, as you say. It would be good to know what the impact of changing the value of |
Zerpet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm half way through the PR, the refactor and the API types make sense, however I'd like to call for a stop here, as I see we are becoming a Pod controller.
I'm unsure if becoming a Pod controller is something we want to get into, and if so, I'd very much encourage a design document, specially highlighting the reasons to chose our Pod controller over the good ol' Deployment or StatefulSet controllers.
|
|
||
| detailMsg := "updates on superStreamReference are forbidden" | ||
|
|
||
| if s.Spec.SuperStreamReference != oldSuperStreamConsumer.Spec.SuperStreamReference { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be a DeepEqual ?
|
Based on the conversation we had this morning during standup, I'll be happy with the current state of the PR once we mark the api version as alpha, something like Would be nice to have an opt-out option to not deploy these CRDs and the role with CRUD permissions on Pod objects, but it shouldn't block this PR. |
|
Closing in favour of #281 |
Note to reviewers: remember to look at the commits in this PR and consider if they can be squashed
Note to contributors: remember to re-generate client set if there are any API changes
Summary Of Changes
npartitions, creates 1 exchange,nstream queues (a.k.a. 'partitions') andnbindingsncan be increased on an existing SuperStream; this will cause new partitions and bindings to be createdncannot be decreased as this could lead to data lossnis increased, additional routing keys must be specified if not left as the index of the bindingrabbitmq.com/super-stream-partitionAdditional Context
These CRDs are compatible with any 3.9 RabbitMQ image where the stream plugin is enabled.
This PR adds a system test which uses Chaos Mesh to simulate a container error in a consumer pod. If Chaos Mesh is not installed on the test system, the test is skipped. For our GKE test clusters, it's pretty simple to install chaos mesh:
helm install chaos-mesh chaos-mesh/chaos-mesh --namespace=chaos-testing --version 2.0.4 --set dashboard.securityMode=false --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/containerd/containerd.sock, and I've done this on the CI cluster.