Skip to content

Commit fbcd41b

Browse files
committed
Support LB spec & coordinator-only annotations
1 parent 969be80 commit fbcd41b

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

charts/trino/templates/service-coordinator.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{{- $coordinatorJmx := merge .Values.jmx.coordinator (omit .Values.jmx "coordinator" "worker") -}}
2+
{{- $coordinatorSvcSpecOverride := index .Values.coordinator.service "spec" | default dict -}}
3+
{{- $coordinatorSvcAnnotations := deepCopy .Values.service.annotations | merge (index .Values.coordinator.service "annotations" | default dict) -}}
24
apiVersion: v1
35
kind: Service
46
metadata:
@@ -8,9 +10,17 @@ metadata:
810
{{- include "trino.labels" . | nindent 4 }}
911
app.kubernetes.io/component: coordinator
1012
annotations:
11-
{{- toYaml .Values.service.annotations | nindent 4 }}
13+
{{- toYaml $coordinatorSvcAnnotations | nindent 4 }}
1214
spec:
13-
type: {{ .Values.service.type }}
15+
{{- if gt (len $coordinatorSvcSpecOverride) 0 }}
16+
{{- toYaml $coordinatorSvcSpecOverride | nindent 2 }}
17+
{{- end }}
18+
19+
{{- if not (hasKey $coordinatorSvcSpecOverride "type") }}
20+
type: {{ default .Values.service.type }}
21+
{{- end }}
22+
23+
{{- if not (hasKey $coordinatorSvcSpecOverride "ports") }}
1424
ports:
1525
- port: {{ .Values.service.port }}
1626
targetPort: http
@@ -43,6 +53,10 @@ spec:
4353
nodePort: {{ $value.nodePort }}
4454
{{- end }}
4555
{{- end }}
56+
{{- end }}
57+
58+
{{- if not (hasKey $coordinatorSvcSpecOverride "selector") }}
4659
selector:
4760
{{- include "trino.selectorLabels" . | nindent 4 }}
4861
app.kubernetes.io/component: coordinator
62+
{{- end }}

charts/trino/templates/service-worker.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{{- $workerJmx := merge .Values.jmx.worker (omit .Values.jmx "coordinator" "worker") -}}
2+
{{- $workerSvcSpecOverride := index .Values.worker.service "spec" | default dict -}}
3+
{{- $workerSvcAnnotations := deepCopy .Values.service.annotations | merge (index .Values.worker.service "annotations" | default dict) -}}
4+
{{- $workerSvcIsLoadBalancer := eq (index $workerSvcSpecOverride "type" | default "") "LoadBalancer" -}}
25
apiVersion: v1
36
kind: Service
47
metadata:
@@ -8,9 +11,17 @@ metadata:
811
{{- include "trino.labels" . | nindent 4 }}
912
app.kubernetes.io/component: worker
1013
annotations:
11-
{{- toYaml .Values.service.annotations | nindent 4 }}
14+
{{- toYaml $workerSvcAnnotations | nindent 4 }}
1215
spec:
16+
{{- if gt (len $workerSvcSpecOverride) 0 }}
17+
{{- toYaml $workerSvcSpecOverride | nindent 2 }}
18+
{{- end }}
19+
20+
{{- if not $workerSvcIsLoadBalancer }}
1321
clusterIP: None
22+
{{- end }}
23+
24+
{{- if not (hasKey $workerSvcSpecOverride "ports") }}
1425
ports:
1526
- port: {{ .Values.service.port }}
1627
targetPort: http
@@ -31,6 +42,10 @@ spec:
3142
nodePort: {{ $value.nodePort }}
3243
{{- end }}
3344
{{- end }}
45+
{{- end }}
46+
47+
{{- if not (hasKey $workerSvcSpecOverride "selector") }}
3448
selector:
3549
{{- include "trino.selectorLabels" . | nindent 4 }}
3650
app.kubernetes.io/component: worker
51+
{{- end }}

charts/trino/values.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,21 @@ secretMounts: []
550550
# ```
551551

552552
coordinator:
553+
service: {}
554+
# coordinator.service -- Service overrides just for the coordinator service. It is merged with the root-level service specification. Beware that specifying spec.ports will override the dynamically generated ports for JMX exporter as well as the additionalExposedPorts.
555+
# @raw
556+
# Example:
557+
# ```yaml
558+
# annotations:
559+
# external-dns.alpha.kubernetes.io/hostname: trino.example.com
560+
# spec:
561+
# type: LoadBalancer
562+
# externalTrafficPolicy: Local
563+
# loadBalancerSourceRanges:
564+
# - 1.2.3.4/32
565+
# - 10.0.0.0/8
566+
# ```
567+
553568
deployment:
554569
annotations: {}
555570
progressDeadlineSeconds: 600
@@ -735,6 +750,20 @@ coordinator:
735750
# ```
736751

737752
worker:
753+
service: {}
754+
# worker.service -- Service overrides just for the worker service. It is merged with the root-level service specification. Beware that specifying spec.ports will override the dynamically generated ports for JMX exporter as well as the additionalExposedPorts.
755+
# @raw
756+
# Example:
757+
# ```yaml
758+
# annotations:
759+
# external-dns.alpha.kubernetes.io/hostname: trino-workers.example.com
760+
# spec:
761+
# type: LoadBalancer
762+
# externalTrafficPolicy: Local
763+
# loadBalancerSourceRanges:
764+
# - 1.2.3.4/32
765+
# - 10.0.0.0/8
766+
# ```
738767
deployment:
739768
annotations: {}
740769
progressDeadlineSeconds: 600

0 commit comments

Comments
 (0)