Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pulsar sink): support tls options #22148

Merged
merged 16 commits into from
Jan 22, 2025

Conversation

pomacanthidae
Copy link
Contributor

@pomacanthidae pomacanthidae commented Jan 9, 2025

Summary

This PR adds TLS options to enable Pulsar sinks and sources to use a custom certificate chain regarding #10888.
Integration tests for pulsar with TLS are added and test data in tests/data/ca/intermediate_server including pem files are generated by the following command.

 make ca/intermediate_server/certs/pulsar-chain.cert.pem

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

run integration test

make test-integration-pulsar

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Please read our Vector contributor resources.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run dd-rust-license-tool write to regenerate the license inventory and commit the changes (if any). More details here.

References

@pomacanthidae pomacanthidae requested review from a team as code owners January 9, 2025 11:13
@bits-bot
Copy link

bits-bot commented Jan 9, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added domain: sources Anything related to the Vector's sources domain: sinks Anything related to the Vector's sinks domain: ci Anything related to Vector's CI environment domain: external docs Anything related to Vector's external, public documentation labels Jan 9, 2025
@pront pront self-assigned this Jan 9, 2025
@pront pront added the sink: pulsar Anything `pulsar` sink related label Jan 9, 2025
#[configurable_component]
#[configurable(description = "TLS options configuration for the Pulsar client.")]
#[derive(Clone, Debug)]
pub struct PulsarTlsOptions {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to reuse the existing config struct we use for TLS options:

pub struct TlsConfig {
?

Or does the pulsar client no support all of the same options?

At the least, we should match the option names (e.g. certificate_chain_file should be ca_file to match).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback.
rust client for pulsar only supports some options https://github.com/streamnative/pulsar-rs/blob/master/src/connection_manager.rs#L73
Changed to use the same field names as TlsConfig 66821d8.

Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this @pomacanthidae ! I appreciate you updating the integration tests including generating the test certificates. I left a question about the new config option.

@pront pront added domain: security Anything related to security domain: networking Anything related to Vector's networking labels Jan 13, 2025
description: "TLS options configuration for the Pulsar client."
required: false
type: object: options: {
allow_insecure_connection: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be called verify_certificate in order to match the existing options.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed in ed01093

Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Not merging just yet, I would like to give @jszwedko a chance to take another look.

Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of final comments, but otherwise 👍 Thanks for your work on this @pomacanthidae !

@@ -0,0 +1,3 @@
Tls options to set custom certificate chain are now available for `pulsar` sink and source.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Tls options to set custom certificate chain are now available for `pulsar` sink and source.
The `pulsar` source and sink now support configuration of TLS options via the `tls` configuration field.

Cleaning this up a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 85de10c


#[configurable(derived)]
#[serde(default)]
pub(crate) tls_options: Option<PulsarTlsOptions>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub(crate) tls_options: Option<PulsarTlsOptions>,
pub(crate) tls: Option<PulsarTlsOptions>,

Apologies, missed this one before. We should call this tls to match the other components.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 59f0634

Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pomacanthidae !

@jszwedko jszwedko enabled auto-merge January 21, 2025 22:55
auto-merge was automatically disabled January 21, 2025 23:05

Head branch was pushed to by a user without write access

@pomacanthidae
Copy link
Contributor Author

Oops, fixed the format to pass the test.
Thanks for your reviews!

@jszwedko jszwedko enabled auto-merge January 21, 2025 23:36
@jszwedko jszwedko added this pull request to the merge queue Jan 22, 2025
Merged via the queue into vectordotdev:master with commit b4aaaa8 Jan 22, 2025
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: ci Anything related to Vector's CI environment domain: external docs Anything related to Vector's external, public documentation domain: networking Anything related to Vector's networking domain: security Anything related to security domain: sinks Anything related to the Vector's sinks domain: sources Anything related to the Vector's sources sink: pulsar Anything `pulsar` sink related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add TLS support to the Pulsar Sink
5 participants