Thundercloud12 opened a new pull request, #6845:
URL: https://github.com/apache/camel-k/pull/6845
Fixes #5935
## Motivation & Context
Camel K `Pipe` resources currently support Strimzi Kafka, Knative, and
Kamelet resources as declarative endpoints. However, there was no native
binding provider for messaging queues managed by the ArkMQ / ActiveMQ Artemis
operator (`broker.amq.io`).
This PR adds a minimal, queue-only `Pipe` binding provider for ArkMQ
operator-managed queues, following the architectural pattern of the existing
Strimzi binding.
---
## Architecture & Design Decisions
Following maintainer guidance on the issue, this implementation focuses
strictly on a minimal queue use case:
```text
ActiveMQArtemisAddress CR
(spec.routingType: anycast)
↓
Camel K duck type
↓
ArkMQ binding provider
↓
JMS queue endpoint
(jms:queue:<queueName>?brokerURL=...)
```
### 1. Queue-Only Resource Target
* Binds exclusively to `ActiveMQArtemisAddress` (`broker.amq.io/v1beta1`).
* Rejects non-address kinds with an informative error.
* Actively rejects `spec.routingType: multicast` (topics) to ensure only
queue bindings are configured.
### 2. Automated Broker Discovery
If `brokerURL` is not manually provided in the Pipe endpoint properties, the
provider:
* Resolves the referenced `ActiveMQArtemis` cluster from `spec.applyTo` or
the `ActiveMQArtemis` label.
* Discovers the broker port from status (`core`, `all`, or `openwire`),
defaulting to the standard `61616`.
* Resolves the in-cluster headless service:
```text
tcp://<cluster>-hdls-svc.<namespace>.svc:<port>
```
### 3. Queue Name Resolution
The queue name is resolved using the following priority:
```text
spec.queueName
↓
spec.addressName
↓
metadata.name
```
### 4. Deterministic Component URI
The provider always generates:
```text
jms:queue:<queueName>?brokerURL=...
```
Any user-supplied Pipe endpoint properties are appended to the generated URI.
---
## Key Changes
* **Duck Types**
* Added minimal `ActiveMQArtemisAddress` and `ActiveMQArtemis` duck types
in `pkg/apis/duck/arkmq/v1beta1/`.
* Registered the duck types with the scheme.
* **Client Generation**
* Added `client-gen` configuration in `script/gen_client.sh`.
* Generated typed clientsets under `pkg/client/arkmq/`.
* **Binding Provider**
* Implemented `ArkMQBindingProvider` in `pkg/util/bindings/arkmq.go`.
* **RBAC**
* Added namespaced and descoped roles and bindings under
`pkg/resources/config/rbac/`.
* Grants read-only (`get`, `list`, `watch`) permissions for:
* `activemqartemises`
* `activemqartemisaddresses`
* **Unit Tests**
* Added `pkg/util/bindings/arkmq_test.go` covering:
* Direct `brokerURL` property override
* Cluster headless service resolution
* Address-by-name fallback
* Multicast topic rejection
* Unsupported resource kinds
* Pass-through behavior
* Added `pkg/controller/pipe/initialize_test.go` covering bidirectional
support:
* **Sink:** `Timer → ArkMQ Queue`
* **Source:** `ArkMQ Queue → Log`
* **Documentation**
* Added ArkMQ queue Pipe documentation and a sample to:
`docs/modules/ROOT/pages/pipes/pipes.adoc`
* **E2E Infrastructure**
* Added the end-to-end test suite under `e2e/arkmq/`.
* Added the `test-arkmq` Makefile target.
* Added the GitHub Actions workflow:
`.github/workflows/arkmq.yml`
* Uses Gomega `Eventually` for asynchronous assertions.
---
## How Has This Been Tested?
The following checks were run successfully:
### Unit Tests
```bash
go test -v ./pkg/util/bindings -run TestArkMQ
go test -v ./pkg/controller/pipe -run TestNewPipeArkMQ
```
### Static Analysis
```bash
go vet ./...
```
`go vet` passes across all packages with zero issues.
### Formatting
```bash
make fmt goimport
```
Both formatting and import checks pass successfully.
--
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]