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

fix: use env prefix in collector config for typecasting #534

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

prashant-shahi
Copy link
Member

@prashant-shahi prashant-shahi commented Oct 16, 2024

Fixes

  • use env prefix in collector config for typecasting
  • only enable hostfs mount when hostmetrics is on

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced configuration flexibility by introducing environment variable references for various components, improving security and deployment adaptability.
    • Updated resource detection configurations for OpenTelemetry Collector to support AWS, GCP, and Azure.
    • Added support for accessing the host filesystem in the OpenTelemetry agent configuration.
  • Bug Fixes

    • Incremented version numbers for k8s-infra and SigNoz Helm charts to reflect recent updates.
  • Documentation

    • Improved comments in configuration files for clarity on environment variable usage and security implications.

Copy link

coderabbitai bot commented Oct 16, 2024

Walkthrough

This pull request includes updates to several Helm chart files, primarily focusing on version increments and enhancements to configuration templates for the OpenTelemetry Collector. The version field in the Chart.yaml files for both k8s-infra and signoz charts has been updated. Additionally, the configuration templates and values files have been modified to utilize environment variables for various parameters, improving flexibility and security in deployment configurations.

Changes

File Change Summary
charts/k8s-infra/Chart.yaml Version updated from 0.11.17 to 0.11.18.
charts/k8s-infra/templates/_config.tpl Updated configuration templates for OpenTelemetry Collector, replacing direct variable references with environment variables and enhancing resource detection configurations.
charts/k8s-infra/values.yaml Adjusted kubeletMetrics endpoint to use environment variable, added existingSecretName to otelTlsSecrets, and updated presets for metrics collection.
charts/signoz/Chart.yaml Version updated from 0.54.0 to 0.54.1.
charts/signoz/values.yaml Updated configuration for ClickHouse and OpenTelemetry components to use environment variables for sensitive data.

Possibly related PRs

Suggested reviewers

  • srikanthccv

🐇 In the meadow, changes bloom,
Helm charts updated, dispelling gloom.
Environment variables now in play,
Flexibility dances, come what may.
With versions rising, we leap and cheer,
For a brighter future, let’s hold it dear! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

Signed-off-by: Prashant Shahi <prashant@signoz.io>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
charts/signoz/values.yaml (1)

1971-1972: Improved security and configurability in OpenTelemetry Collector exporters

The changes in the OpenTelemetry Collector exporters configuration are a significant improvement in terms of security and configurability. By using environment variables (${env:VARIABLE_NAME}) for sensitive information such as usernames, passwords, and host details, the deployment becomes more secure and flexible.

This approach allows for easier management of credentials and connection details across different environments without exposing sensitive information in the configuration files.

Consider applying this pattern consistently across other parts of the configuration where sensitive information or environment-specific values are used. This will further enhance the overall security and maintainability of the deployment.

Also applies to: 1974-1979, 2369-2371

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ec41c66 and 1ff683f.

📒 Files selected for processing (5)
  • charts/k8s-infra/Chart.yaml (1 hunks)
  • charts/k8s-infra/templates/_config.tpl (1 hunks)
  • charts/k8s-infra/values.yaml (1 hunks)
  • charts/signoz/Chart.yaml (1 hunks)
  • charts/signoz/values.yaml (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • charts/k8s-infra/Chart.yaml
  • charts/signoz/Chart.yaml
🧰 Additional context used
🔇 Additional comments (5)
charts/k8s-infra/values.yaml (2)

205-205: LGTM: Improved environment variable handling

The change from ${K8S_HOST_IP}:10250 to ${env:K8S_HOST_IP}:10250 enhances the configuration by explicitly marking K8S_HOST_IP as an environment variable. This aligns with the PR objective of using an env prefix in the collector config for typecasting, which should improve clarity and potentially prevent issues related to variable resolution.


Line range hint 1-1037: Verify the impact on the overall configuration

The change to use the env: prefix for K8S_HOST_IP is the only modification in this file. While this change is beneficial for clarity and proper environment variable handling, it's important to ensure that this modification doesn't have any unintended consequences on the rest of the configuration or the system's behavior.

To confirm that this change doesn't affect other parts of the system, please run the following verification script:

This script will help ensure that the change is consistent across the configuration and that the environment variable is set correctly in the Kubernetes resources.

charts/k8s-infra/templates/_config.tpl (3)

137-140: Ensure Environment Variables for OTLP Exporter are Properly Set

The OTLP exporter configuration now relies on environment variables for endpoint, insecure, and insecure_skip_verify. Please confirm that these environment variables (OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_INSECURE, and OTEL_EXPORTER_OTLP_INSECURE_SKIP_VERIFY) are correctly set in the deployment environment to ensure the exporter functions as intended.


142-145: Verify TLS Certificate Paths and Environment Variable Configuration

The TLS settings reference certificate files using the OTEL_SECRETS_PATH environment variable:

  • cert_file: ${env:OTEL_SECRETS_PATH}/cert.pem
  • key_file: ${env:OTEL_SECRETS_PATH}/key.pem
  • ca_file: ${env:OTEL_SECRETS_PATH}/ca.pem (if applicable)

Please ensure that OTEL_SECRETS_PATH is properly defined and that the certificate files exist at the specified locations. This is crucial for establishing secure connections.


149-149: Confirm Secure Handling of SIGNOZ_API_KEY Environment Variable

The signoz-access-token header is set using the environment variable ${env:SIGNOZ_API_KEY}. Ensure that the SIGNOZ_API_KEY is securely stored and managed according to best practices, and that it's correctly provided in the deployment environment to authenticate with the SigNoz backend.

Signed-off-by: Prashant Shahi <prashant@signoz.io>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
charts/k8s-infra/templates/otel-agent/daemonset.yaml (1)

125-131: Approve volume mount configuration with suggestions for documentation.

The volume mount configuration for hostfs is well-structured with appropriate security considerations:

  • Read-only access limits the potential for accidental or malicious modifications.
  • HostToContainer propagation is necessary for comprehensive metrics collection.

Consider adding inline comments or documentation to explain:

  1. The purpose of this mount and its relation to host metrics collection.
  2. The implications of HostToContainer propagation.
  3. Any specific metrics or data this mount enables the agent to collect.

This will help future maintainers understand the reasoning behind this configuration.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1ff683f and f77e3cd.

📒 Files selected for processing (1)
  • charts/k8s-infra/templates/otel-agent/daemonset.yaml (2 hunks)
🧰 Additional context used
🔇 Additional comments (1)
charts/k8s-infra/templates/otel-agent/daemonset.yaml (1)

56-61: Overall impact: Improved flexibility for host metrics collection.

The changes successfully introduce the ability to collect host metrics when enabled, aligning with the PR objective. The conditional nature of these changes provides good flexibility for different deployment scenarios.

To ensure the changes work as intended and don't introduce any regressions:

  1. Test the DaemonSet deployment with presets.hostMetrics.enabled set to both true and false.
  2. Verify that host metrics are correctly collected when enabled.
  3. Ensure that the DaemonSet functions correctly without host metrics when disabled.
#!/bin/bash
# Check for any existing tests related to host metrics collection
grep -r "hostMetrics" charts/k8s-infra/tests/

If no existing tests are found, consider adding new ones to cover this functionality.

Also applies to: 125-131

@prashant-shahi prashant-shahi merged commit 65de46a into main Oct 17, 2024
3 checks passed
@prashant-shahi prashant-shahi deleted the fix/collector-env branch October 17, 2024 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants