openmeter icon indicating copy to clipboard operation
openmeter copied to clipboard

fix: adds a config option to enable TLS/SSL without needing certs loc…

Open mleonidas opened this issue 8 months ago • 3 comments

…ally (insecure)

Overview

Fixes #(issue)

Notes for reviewer

Summary by CodeRabbit

  • New Features
    • Added an option to allow insecure TLS for Kafka SSL connections (e.g., self-signed certificates). This enables TLS without SASL when explicitly opted in.
    • Expands connectivity to Kafka deployments using SSL with untrusted/temporary certificates while keeping current defaults.
    • Existing behavior remains unchanged unless the option is enabled; SASL_SSL handling is unaffected.

mleonidas avatar Aug 13 '25 19:08 mleonidas

📝 Walkthrough

Walkthrough

Introduces a TLSInsecure boolean in KafkaConfiguration and updates Kafka broker config logic to enable TLS for SSL connections when TLSInsecure is true, prior to SASL_SSL handling. No other validation or config creation references were added.

Changes

Cohort / File(s) Summary
Configuration schema update
app/config/ingest.go
Added exported field TLSInsecure bool to KafkaConfiguration; no accompanying validation or config creation logic changes in this file.
Kafka broker TLS handling
openmeter/watermill/driver/kafka/broker.go
In createKafkaConfig, added conditional to enable TLS when SecurityProtocol == "SSL" and TLSInsecure is true; existing SASL_SSL path unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

✨ Finishing Touches
  • [ ] 📝 Generate Docstrings
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Aug 13 '25 19:08 coderabbitai[bot]

Notably, I encountered this issue while attempting to deploy to an internal Kubernetes cluster in AWS, utilizing MSK as the Kafka cluster. We have our cluster configured for TLS, but due to the certs not being locally or in the container, the brokers would fail to connect.

edit: also sorry about the long commit msg, I've never used cz cli, I have a git template that neogit reads in, but the commit hooks would fail until I used cz :/

mleonidas avatar Aug 13 '25 19:08 mleonidas

@mleonidas as a sidenote, you can specify the required CAs here: https://github.com/openmeterio/openmeter/blob/main/deploy/charts/openmeter/templates/deployment.yaml#L69-L73

turip avatar Aug 17 '25 14:08 turip