UchihaIthachi opened a new pull request, #6974:
URL: https://github.com/apache/camel-k/pull/6974

   <!-- Description -->
   Fixes #6973
   
   Adds a KEDA scaler mapping for the Camel `nats` component when it consumes 
from a durable JetStream consumer, to the KEDA `nats-jetstream` scaler.
   
   - `pkg/trait/keda/scalers/nats.go`: maps `jetstreamName` to `stream`, 
`durableName` to `consumer` with the `-durable` suffix that the Camel consumer 
adds, `account` to `$G`, and the first `servers` entry to 
`natsServerMonitoringEndpoint` on port 8222. URI options take precedence over 
`camel.component.nats.*` properties. A custom `consumerConfiguration`, another 
account or monitoring endpoint can be set with `keda.autoMetadata`.
   - Core NATS subjects and ephemeral JetStream consumers produce no trigger: 
the mapper returns an empty scaler type and `MapToKedaTrigger` 
(`pkg/trait/keda/mapper.go`) returns nil for it. The contributing guide 
mentions this, and the trait docs list the new component.
   - e2e `TestNatsKedaAutoscale` in the KEDA workflow, same flow as the Pulsar 
test: a NATS server with JetStream (`nats:2.11-alpine`, about 64Mi), the 
consumer creates the stream and the durable, scales to 0, a timer producer 
builds a backlog, the consumer scales to 1, logs the messages and scales back 
to 0. YAMLs use the random test namespace through `cloneAndReplaceNamespace`. 
NATS starts in a few seconds, so it adds little to the `test-keda` time.
   
   Tested locally: `go test ./pkg/trait/keda/... ./pkg/trait` (7 mapping cases 
plus 2 `MapToKedaTrigger` cases, including the no-trigger case), `go vet -tags 
integration ./e2e/keda/`, `golangci-lint` (0 issues). The e2e needs a cluster, 
so I compiled it but have not run it; I'll follow the KEDA workflow run here.
   
   I used an AI assistant to help with parts of this change; I reviewed and 
tested every change locally.
   
   <!--
   Please, describe the PR intent carefully, linking it to the github issue 
that it wants to address.
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to