Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/crazy-dogs-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"helm-charts": patch
---

feat: support servicetype and annotations for clickhouse svc
7 changes: 7 additions & 0 deletions charts/hdx-oss-v2/templates/clickhouse-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ metadata:
name: {{ include "hdx-oss.fullname" . }}-clickhouse
labels:
{{- include "hdx-oss.labels" . | nindent 4 }}
{{- if .Values.clickhouse.service.annotations }}
annotations:
{{- with .Values.clickhouse.service.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.clickhouse.service.type | default "ClusterIP" }}
ports:
- port: {{ .Values.clickhouse.port }}
targetPort: {{ .Values.clickhouse.port }}
Expand Down
84 changes: 84 additions & 0 deletions charts/hdx-oss-v2/tests/clickhouse-service_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
suite: Test Clickhouse Service
templates:
- clickhouse-deployment.yaml
tests:
- it: should use LoadBalancer type when configured
set:
clickhouse:
service:
type: LoadBalancer
asserts:
- documentIndex: 1
equal:
path: spec.type
value: LoadBalancer

- it: should use NodePort type when configured
set:
clickhouse:
service:
type: NodePort
asserts:
- documentIndex: 1
equal:
path: spec.type
value: NodePort

- it: should render service annotations when provided
set:
clickhouse:
service:
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
asserts:
- documentIndex: 1
equal:
path: metadata.annotations["service.beta.kubernetes.io/aws-load-balancer-internal"]
value: "true"
- documentIndex: 1
equal:
path: metadata.annotations["service.beta.kubernetes.io/aws-load-balancer-type"]
value: "nlb"

- it: should not render annotations section when annotations are empty
set:
clickhouse:
service:
annotations: {}
asserts:
- documentIndex: 1
isNull:
path: metadata.annotations

- it: should combine LoadBalancer type with annotations
set:
clickhouse:
service:
type: LoadBalancer
annotations:
cloud.google.com/load-balancer-type: "Internal"
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
asserts:
- documentIndex: 1
equal:
path: spec.type
value: LoadBalancer
- documentIndex: 1
equal:
path: metadata.annotations["cloud.google.com/load-balancer-type"]
value: "Internal"
- documentIndex: 1
equal:
path: metadata.annotations["service.beta.kubernetes.io/azure-load-balancer-internal"]
value: "true"

- it: should fallback to ClusterIP when service type is not specified
set:
clickhouse:
service: {}
asserts:
- documentIndex: 1
equal:
path: spec.type
value: ClusterIP
10 changes: 10 additions & 0 deletions charts/hdx-oss-v2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ clickhouse:
# operator: "Equal"
# value: "value1"
# effect: "NoSchedule"

# Service configuration
service:
type: ClusterIP # Use ClusterIP for security. For external access, use ingress with proper TLS and authentication
# Service-level annotations (applied to the Kubernetes service resource)
annotations: {}
# Example service annotations:
# service.beta.kubernetes.io/aws-load-balancer-internal: "true"
# cloud.google.com/load-balancer-type: "Internal"

persistence:
enabled: true
dataSize: 10Gi
Expand Down