rabbitmq / rabbitmq-peer-discovery-k8s

Kubernetes-based peer discovery mechanism for RabbitMQ
Other
295 stars 94 forks source link

Add v1.events POC #61

Closed Gsantomaggio closed 4 years ago

Gsantomaggio commented 4 years ago

Proposed Changes

Please consider this PR as a proposal.

The idea is to add the k8s v1.Event on this plugin

So in this way, the events are exposed to a "watchers" (or an operator) or on the Dashboard, that's would be the output:

$  kubectl get events
<unknown>   Normal    Created                                      Node rabbit@rabbitmq-op-0.rabbitmq-op.default.svc.cluster.local, registered
<unknown>   Normal    NodeUP                                       The Node rabbit@rabbitmq-op-3.rabbitmq-op.default.svc.cluster.local is UP,
<unknown>   Normal    NodeUP                                       The Node rabbit@rabbitmq-op-2.rabbitmq-op.default.svc.cluster.local is UP,
<unknown>   Normal    NodeUP                                       The Node rabbit@rabbitmq-op-1.rabbitmq-op.default.svc.cluster.local is UP,
<unknown>   Normal    Created                                      Node rabbit@rabbitmq-op-0.rabbitmq-op.default.svc.cluster.local, registered
<unknown>   Normal    NodeDown                                     The Node rabbit@rabbitmq-op-3.rabbitmq-op.default.svc.cluster.local is Down,
<unknown>   Normal    NodeUP                                       The Node rabbit@rabbitmq-op-3.rabbitmq-op.default.svc.cluster.local is UP,

Types of Changes

Checklist

Further Comments

Note: This feature requires the following rule:

rules:
- apiGroups: 
    - ""
  resources: 
    - events
  verbs: 
    - create

This PR requires more work, I didn't want to go to much ahead, I wanted to know your opinion on it. Feel free to close/ignore it :)!

michaelklishin commented 4 years ago

I like the idea. Is this purely informational?

Gsantomaggio commented 4 years ago

Is this purely informational?

Yes, at the moment.

It would avoid checking the PODs logs to check the nodes registrations/cluster join/cluster remove.

Gsantomaggio commented 4 years ago

That's how it'd be. What you see with <hostmane> /rabbitmq_plugin is sent by the plugin

events

michaelklishin commented 4 years ago

Can we rename rabbitmq_plugin to something more specific? rabbitmq_peer_discovery perhaps?

Gsantomaggio commented 4 years ago

That's the result:

Screenshot from 2019-12-08 14-27-27

Note: The puglin continues to work event there is no RBAC rule:

rules:
- apiGroups: 
    - ""
  resources: 
    - events
  verbs: 
    - create

You won't see the events, but the node join will continue to work

michaelklishin commented 4 years ago

Backported to v3.8.x.

Gsantomaggio commented 4 years ago

The new node monitor process here is not supervised or linked. I

ops you are right! totally forgot to fix it!

I will add a basic supervision tree

Thanks you