Skip to content

feat: allow exposing additional ports on ClickHouse service and pods#197

Merged
GrigoryPervakov merged 2 commits into
mainfrom
feat-additional-ports
May 27, 2026
Merged

feat: allow exposing additional ports on ClickHouse service and pods#197
GrigoryPervakov merged 2 commits into
mainfrom
feat-additional-ports

Conversation

@GrigoryPervakov
Copy link
Copy Markdown
Member

@GrigoryPervakov GrigoryPervakov commented May 26, 2026

Why

ClickHouse has various server protocols, and we need a way to enable them.

What

Add a new spec field additionalPorts to specify additional ports that should be added to Service's and Pods's spec.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new additionalPorts field on ClickHouseClusterSpec so that users can expose extra TCP ports (e.g., MySQL/Postgres/gRPC protocols) on the operator-managed Pod and headless Service. Manifest plumbing, CRD generation, deepcopy, validation, documentation, an example, and an e2e test are all updated accordingly.

Changes:

  • Add AdditionalPort type/field on ClickHouseClusterSpec with CRD constraints (listMapKey=name, DNS-label name, port range 1–65535) and update CRD/docs/values/deepcopy.
  • Wire the new field into the headless Service and Pod container port lists in templates.go.
  • Add webhook validation for duplicate ports and accompanying webhook unit tests plus an e2e test exercising the MySQL protocol.

Reviewed changes

Copilot reviewed 9 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
api/v1alpha1/clickhousecluster_types.go Adds AdditionalPort type and AdditionalPorts field with validation markers.
api/v1alpha1/zz_generated.deepcopy.go Generated deepcopy for the new type/field.
config/crd/bases/clickhouse.com_clickhouseclusters.yaml Regenerated CRD with the new property and list-map keys.
dist/chart/templates/crd/clickhouseclusters.clickhouse.com.yaml Same CRD regeneration for the chart copy.
dist/chart-cluster/values.yaml Documents the new additionalPorts value.
docs/reference/api-reference.mdx Adds reference documentation for AdditionalPort.
examples/custom_protocols.yaml New example showing how to expose additional protocols.
go.mod / go.sum Adds github.com/go-sql-driver/mysql dependency (used by the e2e test).
internal/controller/clickhouse/templates.go Appends user-declared ports to Service and Container port lists.
internal/webhook/v1alpha1/clickhousecluster_webhook.go Rejects duplicate port numbers across AdditionalPorts.
internal/webhook/v1alpha1/clickhousecluster_webhook_test.go Tests acceptance, duplicate-name (CRD-enforced), and duplicate-port cases.
test/e2e/clickhouse_e2e_test.go New e2e: opens MySQL port via AdditionalPorts and connects via MySQL driver.
Files not reviewed (1)
  • api/v1alpha1/zz_generated.deepcopy.go: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/custom_protocols.yaml Outdated
Comment thread internal/webhook/v1alpha1/clickhousecluster_webhook.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants