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

[Helm] Update configuration to allow use of an external clickhouse instance #8048

Merged
merged 5 commits into from
Jun 25, 2024

Conversation

azhavoro
Copy link
Contributor

@azhavoro azhavoro commented Jun 19, 2024

Motivation and context

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

Summary by CodeRabbit

  • New Features

    • Added configuration for ClickHouse environment variables, enhancing analytics setup and flexibility.
  • Improvements

    • Updated Helm chart version from 0.13.1 to 0.13.2.
  • Configuration Changes

    • Introduced ClickHouse port configuration and environment variables in Helm chart templates and values.

Copy link
Contributor

coderabbitai bot commented Jun 19, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent updates primarily focus on enhancing the analytics functionality by making ClickHouse configuration more flexible. The changes involve replacing hardcoded values with dynamic environment variables and updating the Helm chart version to ensure compatibility. This improves maintainability and scalability of the system.

Changes

Files Change Summaries
components/analytics/vector/vector.toml Updated endpoint URL to use CLICKHOUSE_PORT variable instead of a hardcoded port number.
helm-chart/Chart.yaml Updated the version number from 0.13.1 to 0.13.2.
helm-chart/templates/_helpers.tpl Added definitions for ClickHouse-related environment variables.
helm-chart/templates/analytics/cvat-analytics-secret.yml Introduced the CLICKHOUSE_PORT entry in the stringData section.
helm-chart/templates/cvat_backend/server/deployment.yml Included new environment variable related to ClickHouse in the deployment specification.
helm-chart/templates/cvat_backend/worker_analyticsreports/deployment.yml Added ClickHouse environment variable inclusion in worker configuration.
helm-chart/templates/cvat_backend/worker_export/deployment.yml Added ClickHouse environment variable inclusion in worker configuration for exports.
helm-chart/values.yaml Set the ClickHouse port, specified environment variables for Grafana, updated ClickHouse datasource configuration.

Poem

Through code and charts, the changes flow,
Dynamic ports to help us grow.
No longer stuck on static ground,
With ClickHouse, improvements found!
Charts now versioned, as numbers climb,
In harmony, our data chime.
Hoppity hop, in fields of code,
Where innovations smoothly rode.

Celebrating the dynamic enhancements by a clever little rabbit! 🐰✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ce66873 and 1af98b3.

Files selected for processing (8)
  • components/analytics/vector/vector.toml (1 hunks)
  • helm-chart/Chart.yaml (1 hunks)
  • helm-chart/templates/_helpers.tpl (2 hunks)
  • helm-chart/templates/analytics/cvat-analytics-secret.yml (1 hunks)
  • helm-chart/templates/cvat_backend/server/deployment.yml (1 hunks)
  • helm-chart/templates/cvat_backend/worker_analyticsreports/deployment.yml (1 hunks)
  • helm-chart/templates/cvat_backend/worker_export/deployment.yml (1 hunks)
  • helm-chart/values.yaml (3 hunks)
Files skipped from review due to trivial changes (2)
  • components/analytics/vector/vector.toml
  • helm-chart/Chart.yaml
Additional context used
yamllint
helm-chart/templates/analytics/cvat-analytics-secret.yml

[error] 1-1: syntax error: expected the node content, but found '-' (syntax)

helm-chart/templates/cvat_backend/worker_analyticsreports/deployment.yml

[error] 1-1: syntax error: expected the node content, but found '-' (syntax)

helm-chart/templates/cvat_backend/server/deployment.yml

[error] 1-1: syntax error: expected the node content, but found '-' (syntax)

helm-chart/templates/cvat_backend/worker_export/deployment.yml

[error] 1-1: syntax error: expected the node content, but found '-' (syntax)

Additional comments not posted (7)
helm-chart/templates/analytics/cvat-analytics-secret.yml (1)

20-20: The addition of CLICKHOUSE_PORT to the Kubernetes secret is a good practice for dynamic configuration management.

helm-chart/templates/cvat_backend/worker_analyticsreports/deployment.yml (1)

60-60: Including shared ClickHouse environment variables enhances configuration management and reduces the risk of configuration drift across different components.

helm-chart/templates/_helpers.tpl (1)

143-171: Defining ClickHouse environment variables in a shared template is an excellent practice for maintaining consistency and reducing duplication across deployments.

helm-chart/templates/cvat_backend/server/deployment.yml (1)

62-62: The inclusion of shared ClickHouse environment variables in the server deployment is crucial for integrating external database services and ensures consistent configuration across deployments.

helm-chart/templates/cvat_backend/worker_export/deployment.yml (1)

60-60: Ensure that the ClickHouse environment variables are correctly included and match the expected values from the secret.

helm-chart/values.yaml (2)

329-329: Ensure the ClickHouse port is correctly set and reflects the port exposed by the ClickHouse service.


364-364: Review the Grafana datasource configuration to ensure it correctly references the ClickHouse environment variables. Verify that the tlsSkipVerify setting aligns with your security policies.

Also applies to: 373-378, 380-380

Verification successful

The Grafana datasource configuration correctly references the ClickHouse environment variables, and the tlsSkipVerify setting is set to false, which aligns with stricter security policies.

  • helm-chart/values.yaml:
    • Line 364: envFromSecret: cvat-analytics-secret
    • tlsSkipVerify: false
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify Grafana configuration for ClickHouse datasource.

# Test: Search for 'tlsSkipVerify' setting in Grafana configuration. Expect: Only occurrences where it's set to false.
rg --type yaml 'tlsSkipVerify: false' helm-chart/values.yaml

Length of output: 93



Script:

#!/bin/bash
# Description: Verify that Grafana datasource configuration references ClickHouse environment variables.

# Test: Search for ClickHouse environment variables in Grafana configuration.
rg --type yaml 'ClickHouse' helm-chart/values.yaml

Length of output: 77

@azhavoro azhavoro requested a review from SpecLad June 20, 2024 10:26
helm-chart/templates/_helpers.tpl Show resolved Hide resolved
@@ -141,3 +139,33 @@ The name of the service account to use for backend pods
value: "{{ .Release.Namespace }}"
{{- end }}
{{- end }}

{{- define "cvat.sharedClickhouseEnv" }}
{{- if .Values.analytics.enabled}}
Copy link
Contributor

Choose a reason for hiding this comment

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

So how do you actually switch to an external instance? In Chart.yml, the Clickhouse subchart is enabled if analytics.enabled is true, so there's no way to disable the internal instance without disabling analytics altogether.

@SpecLad
Copy link
Contributor

SpecLad commented Jun 24, 2024

Please add a changelog entry.

@azhavoro azhavoro requested a review from nmanovic as a code owner June 25, 2024 11:19
@azhavoro azhavoro force-pushed the az/update_helm_clickhouse_config branch from 0751da3 to 4767a08 Compare June 25, 2024 11:23
Copy link

sonarcloud bot commented Jun 25, 2024

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (develop@77ac951). Learn more about missing BASE report.
Report is 19 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #8048   +/-   ##
==========================================
  Coverage           ?   83.61%           
==========================================
  Files              ?      383           
  Lines              ?    40440           
  Branches           ?     3815           
==========================================
  Hits               ?    33813           
  Misses             ?     6627           
  Partials           ?        0           
Components Coverage Δ
cvat-ui 79.59% <ø> (?)
cvat-server 87.27% <ø> (?)

@SpecLad SpecLad merged commit cdf50d3 into develop Jun 25, 2024
33 checks passed
@SpecLad SpecLad deleted the az/update_helm_clickhouse_config branch June 25, 2024 16:41
@cvat-bot cvat-bot bot mentioned this pull request Jul 2, 2024
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.

4 participants