Fix #2791: expose sslContextParameters on the opensearch Kamelets - #3000
Merged
Conversation
The issue suggested mapping the component's SSL parameters onto Kamelet
properties. camel-opensearch has no such parameters: its entire TLS surface
beyond enableSSL and certificatePath is one option, sslContextParameters,
typed org.apache.camel.support.jsse.SSLContextParameters. There is nothing
scalar for cipher suites, protocol version, keystores or hostname
verification to map to.
So this takes the issue's second suggestion and lets the operator point at
a pre-configured bean, which reaches all of those at once.
Building the SSLContextParameters inside the template from scalar
properties -- the pattern aws-redshift-sink uses for its data source --
does not work here. Kamelet beans are created unconditionally, and
sslContextParameters takes precedence over certificatePath, so an
always-present bean would silently disable the existing certificate
property for everyone.
The property is optional and passed with {{?sslContextParameters}}, so when
unset the parameter is omitted entirely and behaviour is unchanged.
Verified against the real component: with sslContextParameters set to
"#bean:mySsl" the endpoint resolves the registry bean and connects over
https, failing only with connection refused as there is no cluster; a
second route on the same run with the property unset starts unaffected.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013cgbAH6uDsSJDhMdunDzTS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2791.
The issue offers two approaches. The first — mapping the component's SSL parameters onto Kamelet properties — turns out not to be available, so this implements the second.
Why not scalar properties
camel-opensearchhas no scalar TLS options to map. Its entire TLS surface is:There is nothing for cipher suites, TLS version, keystores or hostname verification to bind to individually — all of it lives inside
SSLContextParameters. So the Kamelet has to hand over that object one way or another.Why not build the bean in the template
The catalog's usual idiom would be to construct it in
template.beansfrom scalar properties, the wayaws-redshift-sinkbuilds itsBasicDataSource. That does not work here, for a reason worth recording:sslContextParameterstakes precedence overcertificatePath(the component says so explicitly).Together those mean an always-present
SSLContextParametersbean would silently disable the existingcertificateproperty for every current user, whether or not they wanted advanced TLS. That is a regression I am not willing to ship for an enhancement.What this does
One optional property per Kamelet, pointing at a bean the operator registers:
Passed with
{{?...}}, so when unset the parameter is omitted from the endpoint URI entirely and nothing changes for existing users. When set, it unlocks everything the issue asked for at once — mTLS client keystore, custom trust store, TLS protocol version, cipher suites — because those are all fields ofSSLContextParameters.Verification
script/validatorreports no errors;mvn clean installpasses with tests from the repository root.Behaviour checked against the real component, with both paths in a single run:
sslContextParameters: "#bean:mySsl"— the endpoint resolves the registry bean and connects over https, failing only with connection refused since there is no cluster on localhost. An unresolvable bean or a rejected option would have failed at startup instead.One thing for reviewers to weigh
This is the catalog's first user-supplied bean reference. Every existing
#bean:{{...}}in the catalog (aws-redshift-sink,databricks-*,avro-*-action, the kafka batch sources) points at a template-local bean the Kamelet itself declares. Here the bean comes from the operator's registry instead.I think that is the right trade for this case, given the two constraints above, and it is how Camel models the option. But it is a genuine pattern decision rather than a mechanical change, so if you would rather the catalog not grow that surface I am happy to close this and instead document in the Kamelet description that advanced TLS requires a custom integration.
hostnameVerifieris the other bean-typed option on this component. I left it out deliberately — it is separable, and one new pattern per PR is enough to judge.Claude Code on behalf of Andrea Cosentino