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: Michael Weibel <[email protected]>
  • Loading branch information
mweibel committed Oct 3, 2024
1 parent 473ecd7 commit 9467e66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/sensors/ha.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ 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
using a Kafka or JetStream Eventbus, in which case a leader election is not required as a
Sensor 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
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/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 9467e66

Please sign in to comment.