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

External clickhouse support #276

Merged
merged 30 commits into from
Jan 31, 2022
Merged

External clickhouse support #276

merged 30 commits into from
Jan 31, 2022

Conversation

macobo
Copy link
Contributor

@macobo macobo commented Jan 27, 2022

Description

This PR is a breaking change, allowing users to connect to an external clickhouse. #190

This involved some bigger changes:

  • (Breaking) clickhouse.host value has been removed and will error if used going forward
  • (Breaking) clickhouse.cluster has been added - previously clickhouse.database was used to determine generated cluster name
  • (Breaking) clickhouse.replication was removed - this is currently unsupported by the app and will require significant work to support. Related: Make self-hosted clickhouse instances shardable posthog#8134
  • (Breaking) clickhouse.enabled semantics changed - previously it tried to spin up posthog without any clickhouse support which wouldn't really work.
  • (Fix) clickhouse.user was previously not respected, instead an admin user was always created.
  • (Feature) externalClickhouse has been added. If you want to use external clickhouse, set clickhouse.enabled: false and set externalClickhouse values. host, cluster, user are always required and either password- or secrets-based auth is available. Note that a clickhouse cluster is required for posthog to run

Documentation PR: PostHog/posthog.com#2855

In practice though using external clickhouse never worked due to a myriad of issues (see PRs linking here)

Code structure notes:

  • I extracted snippets and helpers that are clickhouse-related to _clickhouse.tpl file. Proposing we follow this pattern going forward as well.
  • _clickhouse.tpl is unit-tested using a helper template in charts/posthog/templates/test-templates/clickhouse-env.yaml. Files in that folder are not tested.
  • I added a clickhouse connectivity test testing connecting to both external and internal clickhouse via the web pod.
  • Some more test utils iteration was done to cut down on boilerplate. Opinions welcome 🙇

Related TODOs:

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@macobo macobo force-pushed the external-clickhouse2 branch 2 times, most recently from 90a4ef6 to 857c7fb Compare January 27, 2022 10:50
@macobo macobo changed the title WIP: External clickhouse support External clickhouse support Jan 27, 2022
@macobo macobo marked this pull request as ready for review January 27, 2022 11:26
@@ -0,0 +1,9 @@
{{- if .Values.testTemplates -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a README.md in this folder with the explanation on why we need those templates? I think I've linked you recently the issue in helm unittest about it (but I can't find it anymore)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't - it would break helm templating. :(

I could rename this to templates/_test_template.yaml though and add the comment there? We could add all the testing-specific templates to a file instead of a folder then.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good but feel free to merge this and then we can iterate further

@macobo macobo force-pushed the external-clickhouse2 branch from b175799 to e4089af Compare January 28, 2022 12:29
@macobo macobo force-pushed the external-clickhouse2 branch from e4089af to c48e73a Compare January 28, 2022 12:43
@macobo macobo force-pushed the external-clickhouse2 branch from 1c6859a to a317f9c Compare January 30, 2022 12:57
@macobo macobo force-pushed the external-clickhouse2 branch from 55b3e0d to 96369b5 Compare January 30, 2022 19:51
@macobo macobo merged commit a20155d into main Jan 31, 2022
@macobo macobo deleted the external-clickhouse2 branch January 31, 2022 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump major Increases chart version to x+1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants