This is an automated email from the ASF dual-hosted git repository.

oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git


The following commit(s) were added to refs/heads/main by this push:
     new 2015bcf89 Fix #2973: strip non-contract dispatch headers in 
aws-ec2-sink (#2978)
2015bcf89 is described below

commit 2015bcf89c65570ae34b8bf4afce636b297baa4d
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Aug 25 16:35:55 2026 +0200

    Fix #2973: strip non-contract dispatch headers in aws-ec2-sink (#2978)
    
    * Fix #2973: strip non-contract dispatch headers in exec-sink, kafka-sink 
and aws-ec2-sink
    
    These three templates deliberately consume one header from their component's
    family and passed the rest through. Keep the documented interface, drop the
    rest:
    
    - exec-sink keeps args / ce-args -> CamelExecCommandArgs; strips
      CamelExecCommandExecutable, CamelExecCommandWorkingDir and
      CamelExecCommandOutFile, none of which the template maps.
    - kafka-sink keeps key / partition-key; strips CamelKafkaOverrideTopic and
      CamelKafkaOverrideTimestamp, so the topic stays pinned to {{topic}}.
    - aws-ec2-sink keeps instanceIds / ce-instanceids; strips
      CamelAwsEC2Operation, so the operation stays pinned to
      describeInstancesStatus.
    
    Note on exec-sink: the documented CamelExecCommandExecutable override could
    not be reproduced on Camel 4.21 in either direction, and the header was not
    consumed by the component. The strip is kept as cheap insurance but is not
    closing a demonstrated path. See the issue for details.
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
    
    * Fix #2973: address review feedback - pattern-based strip, drop kafka-sink
    
    Per review: use removeHeaders with a pattern, applied before the Kamelet
    sets its own headers, so future component header keys are covered too.
    
    - exec-sink: removeHeaders pattern "CamelExec*" ahead of the args/ce-args
      choice. Also covers CamelExecCommandTimeout / ExitValues / LogLevel,
      which the enumerated version missed.
    - aws-ec2-sink: removeHeaders pattern "CamelAwsEC2*" ahead of the
      instanceIds/ce-instanceids choice, excluding CamelAwsEC2NextToken and
      CamelAwsEC2MaxResults - the pagination headers the pinned read-only
      describeInstancesStatus operation actually reads.
    - kafka-sink: reverted. Stripping CamelKafkaOverrideTopic breaks
      regex-router-action, timestamp-router-action and
      message-timestamp-router-action, which exist solely to set that header
      for a downstream kafka-sink. Header-driven topic override is a designed
      catalog feature, not an unintended pass-through.
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
    
    * Fix #2973: drop exec-sink, keep only aws-ec2-sink
    
    camel-exec honours none of its documented CamelExecCommand* headers (#2980),
    so stripping them in exec-sink is a no-op today. Rather than carry a no-op
    until that is fixed upstream, narrow this PR to aws-ec2-sink, whose
    CamelAwsEC2Operation strip guards a pinned read-only operation and takes
    effect now.
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
    
    ---------
    
    Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
---
 kamelets/aws-ec2-sink.kamelet.yaml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/kamelets/aws-ec2-sink.kamelet.yaml 
b/kamelets/aws-ec2-sink.kamelet.yaml
index adb062fdc..407b66081 100644
--- a/kamelets/aws-ec2-sink.kamelet.yaml
+++ b/kamelets/aws-ec2-sink.kamelet.yaml
@@ -98,6 +98,15 @@ spec:
     from:
       uri: kamelet:source
       steps:
+      # Strip the whole camel-aws2-ec2 header family up-front, before this
+      # Kamelet applies its own contract below: the operation is pinned to the
+      # read-only describeInstancesStatus and instanceIds / ce-instanceids is
+      # the only interface the definition advertises. Using a pattern also
+      # covers CamelAwsEC2* keys the component may add in the future. The
+      # pagination headers that describeInstancesStatus itself reads are kept.
+      - removeHeaders:
+          pattern: "CamelAwsEC2*"
+          excludePattern: "CamelAwsEC2(NextToken|MaxResults)"
       - choice:
           when:
           - simple: "${header[instanceIds]}"

Reply via email to