charts icon indicating copy to clipboard operation
charts copied to clipboard

Manage instance like zookeeper and operator

Open nlamirault opened this issue 1 year ago • 4 comments

Fix #427

  • Consolidated ClickHouse settings under an instance-specific grouping for improved clarity and manageability.
  • Choice to enable or not the Clickhouse Operator and a clickhouse Instance.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added conditional creation of custom function and script resources.
    • Introduced a new ConfigMap for ClickHouse custom functions.
    • Enabled more flexible operator deployment with configurable service, role, binding, and secret setups.
  • Refactor

    • Reorganized ClickHouse settings into an instance-specific configuration for improved clarity and maintainability.
    • Updated resource creation logic across the platform to ensure components are deployed only when explicitly enabled.

nlamirault avatar Feb 11 '25 07:02 nlamirault

Walkthrough

Refactors ClickHouse Helm charts to nest instance settings under .Values.clickhouseInstance and gate ClickHouse resources behind clickhouseInstance.enabled; introduces a separate clickhouseOperator section with conditional operator templates; adds a ConfigMap for custom functions and updates helpers to use instance-scoped value paths.

Changes

Cohort / File(s) Summary
Helpers refactor
charts/clickhouse/templates/_helper.tpl
Replaced root-scoped references with .Values.clickhouseInstance.* for service account creation/annotations, image registries/names, initContainers, imagePullSecrets, and coldStorage checks.
ClickHouse instance templates
charts/clickhouse/templates/clickhouse-instance/clickhouse-instance.yaml, .../configmap.yaml, .../exporter-configmap.yaml, .../scripts-configmap.yaml, .../serviceaccount.yaml, .../storage-class.yaml
Wrapped rendering with if .Values.clickhouseInstance.enabled; migrated most template value references to .Values.clickhouseInstance.*; added ConfigMap for custom functions; updated exporter/script configmaps and storage-class gating.
Operator templates (conditional)
charts/clickhouse/templates/clickhouse-operator/*.yaml
Added conditional rendering when .Values.clickhouseOperator.enabled for deployment, namespace, RBAC (Role/RoleBinding), secret, and serviceaccount resources including operator deployment and metrics exporter.
Values restructuring
charts/clickhouse/values.yaml
Consolidated ClickHouse configuration under clickhouseInstance and introduced clickhouseOperator; added nested sections for probes, persistence, logs, coldStorage, initContainers, templates, resources, and operator settings.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User values.yaml
  participant H as Helm Template Engine
  participant CI as clickhouse-instance templates
  participant CO as clickhouse-operator templates

  U->>H: Provide values
  alt clickhouseInstance.enabled == true
    H->>CI: Render ClickHouseInstallation + related resources
  else
    H--xCI: Skip ClickHouse instance resources
  end

  alt clickhouseOperator.enabled == true
    H->>CO: Render Operator (NS/RBAC/SA/Secret/Deploy)
  else
    H--xCO: Skip Operator resources
  end

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Assessment against linked issues

Objective Addressed Explanation
Provide option to disable clickhouse-instance.yaml (#427)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Added full clickhouseOperator resources (deployment, RBAC, namespace, secret, SA) (charts/clickhouse/templates/clickhouse-operator/*.yaml) Operator deployment and RBAC are beyond the single-objective request to disable clickhouse-instance.yaml.
Large values schema refactor moving many root keys into clickhouseInstance and adding clickhouseOperator (charts/clickhouse/values.yaml, entire file) Extensive schema changes exceed the narrow goal of adding a single toggle and affect many public paths.
New custom functions ConfigMap for UDFs (charts/clickhouse/templates/clickhouse-instance/configmap.yaml) Introducing UDF ConfigMap adds functionality unrelated to disabling the instance manifest.
Helpers update to instance-scoped image/pullSecret/coldStorage references (charts/clickhouse/templates/_helper.tpl) Broad helper refactors change value lookup locations across templates rather than solely gating the instance file.

Suggested reviewers

  • grandwizard28

Poem

I twitch my whiskers at a flag so bright,
One flip and instances sleep at night.
Operators wait in their own green glen,
Configs nested snug like a little den.
Hop—deploys now heed the toggled light. 🐰✨

✨ Finishing Touches
🧪 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 or @coderabbit 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 Feb 11 '25 07:02 coderabbitai[bot]

I understand that we are trying to disable Clickhouse itself from being deployed. Then what would be the use of this chart? Wouldn't it be simpler to have clickhouse.enabled = false in the SigNoz helm chart?

therealpandey avatar Feb 11 '25 08:02 therealpandey

It's to use this chars in 2 separate Argo-CD applications: One which deploy only the Clickhouse operator, and one which manage Clickhouse instance

nlamirault avatar Feb 11 '25 08:02 nlamirault

We're having a discussion on this internally. It'll take some time for the discussion to wrap up. Let me get back to you! Appreciate the effort here :)

therealpandey avatar Feb 12 '25 10:02 therealpandey

any news @grandwizard28 ?

nlamirault avatar May 31 '25 15:05 nlamirault

there is a new one for the Operator part: https://github.com/SigNoz/charts/pull/730

nlamirault avatar Sep 01 '25 07:09 nlamirault

See:

  • https://github.com/SigNoz/charts/pull/730
  • https://github.com/SigNoz/charts/pull/740

nlamirault avatar Sep 01 '25 11:09 nlamirault