Claus Ibsen created CAMEL-27882:
-----------------------------------

             Summary: camel-knative: endpoint filter, ce.override and transport 
options leak into other endpoints, endpoint sinkBinding is not applied, 
K_CE_OVERRIDES is parsed wrongly
                 Key: CAMEL-27882
                 URL: https://issues.apache.org/jira/browse/CAMEL-27882
             Project: Camel
          Issue Type: Bug
          Components: camel-knative
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-knative for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31155).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. Endpoint options leak into the component and other endpoints
{{KnativeConfiguration.copy()}} is shallow, so every endpoint shares the 
transportOptions map of the component (always) and its filters and ceOverride 
maps (when set on the component). {{KnativeComponent.createEndpoint}} then does 
putAll of the filter.*, ce.override.* and transport.* options of the endpoint 
into those shared maps, so they show up on the component and on every endpoint 
created later (confirmed with a test: ce.override.ce-source of endpoint A 
appeared on endpoint B).
Proposed change: deep-copy the three maps in copy().

h4. 2. Endpoint sinkBinding and environment are applied too late
They are set by setProperties after getKnativeConfiguration() has resolved the 
environment, so an endpoint sinkBinding never adds the K_SINK resource (only 
the producer health check uses it), and an endpoint environment only works when 
the component can also resolve one, otherwise the endpoint creation fails with 
IllegalStateException.
Proposed change: bind the endpoint parameters before resolving the environment 
and the sink binding.

h4. 3. K_CE_OVERRIDES is parsed as a flat map
{{KnativeSupport.asResource()}} reads K_CE_OVERRIDES as Map<String,String>, but 
Knative injects it as {"extensions":{...}}, so a real SinkBinding with 
ceOverrides fails to parse; a flat key foo would also be sent as header foo, 
not ce-foo.
Proposed change: read the extensions object and prefix each key with ce-.

h4. 4. Smaller issues
The component-level typeId takes precedence over the name in the URI, because 
doInit only sets it when empty. With replyWithCloudEvent=true on 
knative:event/<type>, the reply gets the type the consumer accepts, so a broker 
sends it straight back unless ceOverride sets another ce-type. 
cloudEventsSpecVersion offers 1.0.1 and 1.0.2 and sends them as ce-specversion, 
while the CloudEvents spec keeps "1.0" for all 1.0.x releases.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to