diff --git a/charts/trino/README.md b/charts/trino/README.md index d5d67b28..3eed42c1 100644 --- a/charts/trino/README.md +++ b/charts/trino/README.md @@ -491,6 +491,20 @@ Fast distributed SQL query engine for big data analytics that helps you explore path: /secrets/sample.json subPath: sample.json ``` +* `coordinator.service` - object, default: `{}` + + 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. + Example: + ```yaml + annotations: + external-dns.alpha.kubernetes.io/hostname: trino.example.com + spec: + type: LoadBalancer + externalTrafficPolicy: Local + loadBalancerSourceRanges: + - 1.2.3.4/32 + - 10.0.0.0/8 + ``` * `coordinator.deployment.annotations` - object, default: `{}` * `coordinator.deployment.progressDeadlineSeconds` - int, default: `600` @@ -629,6 +643,20 @@ Fast distributed SQL query engine for big data analytics that helps you explore path: /secrets/sample.json subPath: sample.json ``` +* `worker.service` - object, default: `{}` + + 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. + Example: + ```yaml + annotations: + external-dns.alpha.kubernetes.io/hostname: trino-workers.example.com + spec: + type: LoadBalancer + externalTrafficPolicy: Local + loadBalancerSourceRanges: + - 1.2.3.4/32 + - 10.0.0.0/8 + ``` * `worker.deployment.annotations` - object, default: `{}` * `worker.deployment.progressDeadlineSeconds` - int, default: `600` diff --git a/charts/trino/templates/service-coordinator.yaml b/charts/trino/templates/service-coordinator.yaml index cd9ab1a7..25d6f141 100644 --- a/charts/trino/templates/service-coordinator.yaml +++ b/charts/trino/templates/service-coordinator.yaml @@ -1,4 +1,6 @@ {{- $coordinatorJmx := merge .Values.jmx.coordinator (omit .Values.jmx "coordinator" "worker") -}} +{{- $coordinatorSvcSpecOverride := index .Values.coordinator.service "spec" | default dict -}} +{{- $coordinatorSvcAnnotations := deepCopy .Values.service.annotations | merge (index .Values.coordinator.service "annotations" | default dict) -}} apiVersion: v1 kind: Service metadata: @@ -8,9 +10,17 @@ metadata: {{- include "trino.labels" . | nindent 4 }} app.kubernetes.io/component: coordinator annotations: - {{- toYaml .Values.service.annotations | nindent 4 }} + {{- toYaml $coordinatorSvcAnnotations | nindent 4 }} spec: - type: {{ .Values.service.type }} + {{- if gt (len $coordinatorSvcSpecOverride) 0 }} + {{- toYaml $coordinatorSvcSpecOverride | nindent 2 }} + {{- end }} + + {{- if not (hasKey $coordinatorSvcSpecOverride "type") }} + type: {{ default .Values.service.type }} + {{- end }} + + {{- if not (hasKey $coordinatorSvcSpecOverride "ports") }} ports: - port: {{ .Values.service.port }} targetPort: http @@ -43,6 +53,10 @@ spec: nodePort: {{ $value.nodePort }} {{- end }} {{- end }} + {{- end }} + + {{- if not (hasKey $coordinatorSvcSpecOverride "selector") }} selector: {{- include "trino.selectorLabels" . | nindent 4 }} app.kubernetes.io/component: coordinator + {{- end }} diff --git a/charts/trino/templates/service-worker.yaml b/charts/trino/templates/service-worker.yaml index 733b27ed..3bb4a2c9 100644 --- a/charts/trino/templates/service-worker.yaml +++ b/charts/trino/templates/service-worker.yaml @@ -1,4 +1,7 @@ {{- $workerJmx := merge .Values.jmx.worker (omit .Values.jmx "coordinator" "worker") -}} +{{- $workerSvcSpecOverride := index .Values.worker.service "spec" | default dict -}} +{{- $workerSvcAnnotations := deepCopy .Values.service.annotations | merge (index .Values.worker.service "annotations" | default dict) -}} +{{- $workerSvcIsLoadBalancer := eq (index $workerSvcSpecOverride "type" | default "") "LoadBalancer" -}} apiVersion: v1 kind: Service metadata: @@ -8,9 +11,17 @@ metadata: {{- include "trino.labels" . | nindent 4 }} app.kubernetes.io/component: worker annotations: - {{- toYaml .Values.service.annotations | nindent 4 }} + {{- toYaml $workerSvcAnnotations | nindent 4 }} spec: + {{- if gt (len $workerSvcSpecOverride) 0 }} + {{- toYaml $workerSvcSpecOverride | nindent 2 }} + {{- end }} + + {{- if not $workerSvcIsLoadBalancer }} clusterIP: None + {{- end }} + + {{- if not (hasKey $workerSvcSpecOverride "ports") }} ports: - port: {{ .Values.service.port }} targetPort: http @@ -31,6 +42,10 @@ spec: nodePort: {{ $value.nodePort }} {{- end }} {{- end }} + {{- end }} + + {{- if not (hasKey $workerSvcSpecOverride "selector") }} selector: {{- include "trino.selectorLabels" . | nindent 4 }} app.kubernetes.io/component: worker + {{- end }} diff --git a/charts/trino/values.yaml b/charts/trino/values.yaml index 4733c8b9..dd6c1f2a 100644 --- a/charts/trino/values.yaml +++ b/charts/trino/values.yaml @@ -550,6 +550,21 @@ secretMounts: [] # ``` coordinator: + service: {} + # 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. + # @raw + # Example: + # ```yaml + # annotations: + # external-dns.alpha.kubernetes.io/hostname: trino.example.com + # spec: + # type: LoadBalancer + # externalTrafficPolicy: Local + # loadBalancerSourceRanges: + # - 1.2.3.4/32 + # - 10.0.0.0/8 + # ``` + deployment: annotations: {} progressDeadlineSeconds: 600 @@ -735,6 +750,20 @@ coordinator: # ``` worker: + service: {} + # 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. + # @raw + # Example: + # ```yaml + # annotations: + # external-dns.alpha.kubernetes.io/hostname: trino-workers.example.com + # spec: + # type: LoadBalancer + # externalTrafficPolicy: Local + # loadBalancerSourceRanges: + # - 1.2.3.4/32 + # - 10.0.0.0/8 + # ``` deployment: annotations: {} progressDeadlineSeconds: 600