Skip to content

Commit

Permalink
feat(sensor): disable leader election for jetstream eventbus
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Currah <[email protected]>
  • Loading branch information
ryancurrah committed Sep 27, 2024
1 parent 0d31a3e commit 9a54370
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions docs/sensors/ha.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ behaviors!**
## Kubernetes Leader Election

By default, Argo Events will use NATS for the HA leader election except when
using a Kafka Eventbus, in which case a leader election is not required as a
Sensor that uses a Kafka EventBus is capable of horizontally scaling. If using
a different EventBus you can opt-in to a Kubernetes native leader election by
specifying the following annotation.
using a Kafka or JetStream Eventbus, in which case a leader election is not
required as aSensor that uses a Kafka/JetStream EventBus is capable of horizontally
scaling. If using a different EventBus you can opt-in to a Kubernetes native leader
election by specifying the following annotation.
```yaml
annotations:
events.argoproj.io/leader-election: k8s
Expand Down
4 changes: 2 additions & 2 deletions pkg/sensors/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func (sensorCtx *SensorContext) Start(ctx context.Context) error {
replicas := int(sensorCtx.sensor.Spec.GetReplicas())
leasename := fmt.Sprintf("sensor-%s", sensorCtx.sensor.Name)

// sensor for kafka eventbus can be scaled horizontally,
// sensor for kafka or jetstream eventbus can be scaled horizontally,
// therefore does not require an elector
if sensorCtx.eventBusConfig.Kafka != nil {
if sensorCtx.eventBusConfig.Kafka != nil || sensorCtx.eventBusConfig.JetStream != nil {
return sensorCtx.listenEvents(ctx)
}

Expand Down

0 comments on commit 9a54370

Please sign in to comment.