Skip to content

Commit 7fd0675

Browse files
committed
Add option to enable JMX exporter on workers
1 parent 36a759a commit 7fd0675

14 files changed

+275
-48
lines changed

charts/trino/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,30 @@ Fast distributed SQL query engine for big data analytics that helps you explore
703703
cpu: 100m
704704
memory: 128Mi
705705
```
706+
* `jmx.coordinator` - object, default: `{}`
707+
708+
Override JMX configurations for the Trino coordinator.
709+
Example
710+
```yaml
711+
coordinator:
712+
enabled: true
713+
exporter:
714+
enable: true
715+
configProperties: |-
716+
hostPort: localhost:{{- .Values.jmx.registryPort }}
717+
startDelaySeconds: 0
718+
ssl: false
719+
```
720+
* `jmx.worker` - object, default: `{}`
721+
722+
Override JMX configurations for the Trino workers.
723+
Example
724+
```yaml
725+
worker:
726+
enabled: true
727+
exporter:
728+
enable: true
729+
```
706730
* `serviceMonitor.enabled` - bool, default: `false`
707731

708732
Set to true to create resources for the [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator).
@@ -712,6 +736,26 @@ Fast distributed SQL query engine for big data analytics that helps you explore
712736
* `serviceMonitor.interval` - string, default: `"30s"`
713737

714738
The serviceMonitor web endpoint interval
739+
* `serviceMonitor.coordinator` - object, default: `{}`
740+
741+
Override ServiceMonitor configurations for the Trino coordinator.
742+
Example
743+
```yaml
744+
coordinator:
745+
enabled: true
746+
labels:
747+
prometheus: my-prometheus
748+
```
749+
* `serviceMonitor.worker` - object, default: `{}`
750+
751+
Override ServiceMonitor configurations for the Trino workers.
752+
Example
753+
```yaml
754+
worker:
755+
enabled: true
756+
labels:
757+
prometheus: my-prometheus
758+
```
715759
* `commonLabels` - object, default: `{}`
716760

717761
Labels that get applied to every resource's metadata

charts/trino/templates/configmap-coordinator.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- $coordinatorJmx := merge .Values.jmx.coordinator (omit .Values.jmx "coordinator" "worker") -}}
12
apiVersion: v1
23
kind: ConfigMap
34
metadata:
@@ -43,8 +44,8 @@ data:
4344
{{- range $configValue := .Values.coordinator.additionalJVMConfig }}
4445
{{ $configValue }}
4546
{{- end }}
46-
{{- if .Values.jmx.enabled }}
47-
-Dcom.sun.management.jmxremote.rmi.port={{ .Values.jmx.serverPort }}
47+
{{- if $coordinatorJmx.enabled }}
48+
-Dcom.sun.management.jmxremote.rmi.port={{- $coordinatorJmx.serverPort }}
4849
{{- end }}
4950

5051
config.properties: |
@@ -72,9 +73,9 @@ data:
7273
http-server.https.port={{ .Values.server.config.https.port }}
7374
http-server.https.keystore.path={{ .Values.server.config.https.keystore.path }}
7475
{{- end }}
75-
{{- if .Values.jmx.enabled }}
76-
jmx.rmiregistry.port={{ .Values.jmx.registryPort }}
77-
jmx.rmiserver.port={{ .Values.jmx.serverPort }}
76+
{{- if $coordinatorJmx.enabled }}
77+
jmx.rmiregistry.port={{- $coordinatorJmx.registryPort }}
78+
jmx.rmiserver.port={{- $coordinatorJmx.serverPort }}
7879
{{- end }}
7980
{{- if .Values.server.coordinatorExtraConfig }}
8081
{{- .Values.server.coordinatorExtraConfig | nindent 4 }}
Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
1-
{{- if .Values.jmx.exporter.enabled }}
1+
{{- $coordinatorJmx := merge .Values.jmx.coordinator (omit .Values.jmx "coordinator" "worker") -}}
2+
{{- if $coordinatorJmx.exporter.enabled }}
23
apiVersion: v1
34
kind: ConfigMap
45
metadata:
5-
name: {{ template "trino.fullname" . }}-jmx-exporter-config
6+
name: {{ template "trino.fullname" . }}-jmx-exporter-config-coordinator
67
namespace: {{ .Release.Namespace }}
78
labels:
89
{{- include "trino.labels" . | nindent 4 }}
910
app.kubernetes.io/component: jmx
1011
data:
1112
jmx-exporter-config.yaml: |-
12-
{{- tpl .Values.jmx.exporter.configProperties . | nindent 4 }}
13+
{{- tpl $coordinatorJmx.exporter.configProperties . | nindent 4 }}
14+
{{- end }}
15+
{{- $workerJmx := merge .Values.jmx.worker (omit .Values.jmx "coordinator" "worker") -}}
16+
{{- if $workerJmx.exporter.enabled }}
17+
---
18+
apiVersion: v1
19+
kind: ConfigMap
20+
metadata:
21+
name: {{ template "trino.fullname" . }}-jmx-exporter-config-worker
22+
namespace: {{ .Release.Namespace }}
23+
labels:
24+
{{- include "trino.labels" . | nindent 4 }}
25+
app.kubernetes.io/component: jmx
26+
data:
27+
jmx-exporter-config.yaml: |-
28+
{{- tpl $workerJmx.exporter.configProperties . | nindent 4 }}
1329
{{- end }}

charts/trino/templates/configmap-worker.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- $workerJmx := merge .Values.jmx.worker (omit .Values.jmx "coordinator" "worker") -}}
12
{{- if gt (int .Values.server.workers) 0 }}
23
apiVersion: v1
34
kind: ConfigMap
@@ -44,6 +45,9 @@ data:
4445
{{- range $configValue := .Values.worker.additionalJVMConfig }}
4546
{{ $configValue }}
4647
{{- end }}
48+
{{- if $workerJmx.enabled }}
49+
-Dcom.sun.management.jmxremote.rmi.port={{- $workerJmx.serverPort }}
50+
{{- end }}
4751

4852
config.properties: |
4953
coordinator=false
@@ -57,6 +61,10 @@ data:
5761
{{- range $configValue := .Values.additionalConfigProperties }}
5862
{{ $configValue }}
5963
{{- end }}
64+
{{- if $workerJmx.enabled }}
65+
jmx.rmiregistry.port={{- $workerJmx.registryPort }}
66+
jmx.rmiserver.port={{- $workerJmx.serverPort }}
67+
{{- end }}
6068
{{- if .Values.server.workerExtraConfig }}
6169
{{- .Values.server.workerExtraConfig | nindent 4 }}
6270
{{- end }}

charts/trino/templates/deployment-coordinator.yaml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- $coordinatorJmx := merge .Values.jmx.coordinator (omit .Values.jmx "coordinator" "worker") -}}
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
@@ -79,10 +80,10 @@ spec:
7980
path: group.db
8081
{{- end }}
8182
{{- end }}
82-
{{- if .Values.jmx.exporter.enabled }}
83+
{{- if $coordinatorJmx.exporter.enabled }}
8384
- name: jmx-exporter-config-volume
8485
configMap:
85-
name: {{ template "trino.fullname" . }}-jmx-exporter-config
86+
name: {{ template "trino.fullname" . }}-jmx-exporter-config-coordinator
8687
{{- end }}
8788
{{- range .Values.configMounts }}
8889
- name: {{ .name }}
@@ -170,16 +171,14 @@ spec:
170171
- name: http
171172
containerPort: {{ .Values.service.port }}
172173
protocol: TCP
173-
{{- with .Values.jmx }}
174-
{{- if .enabled }}
174+
{{- if $coordinatorJmx.enabled }}
175175
- name: jmx-registry
176-
containerPort: {{ .registryPort }}
176+
containerPort: {{ $coordinatorJmx.registryPort }}
177177
protocol: TCP
178178
- name: jmx-server
179-
containerPort: {{ .serverPort }}
179+
containerPort: {{ $coordinatorJmx.serverPort }}
180180
protocol: TCP
181181
{{- end }}
182-
{{- end }}
183182
{{- range $key, $value := .Values.coordinator.additionalExposedPorts }}
184183
- name: {{ $value.name }}
185184
containerPort: {{ $value.port }}
@@ -206,31 +205,25 @@ spec:
206205
{{- toYaml .Values.coordinator.lifecycle | nindent 12 }}
207206
resources:
208207
{{- toYaml .Values.coordinator.resources | nindent 12 }}
209-
{{- with .Values.jmx.exporter }}
210-
{{- if .enabled }}
208+
{{- if $coordinatorJmx.exporter.enabled }}
211209
- name: jmx-exporter
212-
image: {{ .image }}
213-
imagePullPolicy: {{ .pullPolicy }}
214-
{{- with .securityContext }}
210+
image: {{ $coordinatorJmx.exporter.image }}
211+
imagePullPolicy: {{ $coordinatorJmx.exporter.pullPolicy }}
215212
securityContext:
216-
{{- toYaml . | nindent 12 }}
217-
{{- end }}
213+
{{- toYaml $coordinatorJmx.exporter.securityContext | nindent 12 }}
218214
args:
219-
- "{{ .port }}"
215+
- "{{ $coordinatorJmx.exporter.port }}"
220216
- /etc/jmx-exporter/jmx-exporter-config.yaml
221217
volumeMounts:
222218
- mountPath: /etc/jmx-exporter/
223219
name: jmx-exporter-config-volume
224-
{{- with .resources }}
225220
resources:
226-
{{- toYaml . | nindent 12 }}
227-
{{- end }}
221+
{{- toYaml $coordinatorJmx.exporter.resources | nindent 12 }}
228222
ports:
229223
- name: jmx-exporter
230-
containerPort: {{ .port }}
224+
containerPort: {{ $coordinatorJmx.exporter.port }}
231225
protocol: TCP
232226
{{- end }}
233-
{{- end }}
234227
{{- if .Values.sidecarContainers.coordinator }}
235228
{{- toYaml .Values.sidecarContainers.coordinator | nindent 8 }}
236229
{{- end }}

charts/trino/templates/deployment-worker.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- $workerJmx := merge .Values.jmx.worker (omit .Values.jmx "coordinator" "worker") -}}
12
{{- if gt (int .Values.server.workers) 0 }}
23
apiVersion: apps/v1
34
kind: Deployment
@@ -55,6 +56,11 @@ spec:
5556
- name: schemas-volume
5657
configMap:
5758
name: {{ template "trino.fullname" . }}-schemas-volume-worker
59+
{{- if $workerJmx.exporter.enabled }}
60+
- name: jmx-exporter-config-volume
61+
configMap:
62+
name: {{ template "trino.fullname" . }}-jmx-exporter-config-worker
63+
{{- end }}
5864
{{- range .Values.configMounts }}
5965
- name: {{ .name }}
6066
configMap:
@@ -129,6 +135,14 @@ spec:
129135
- name: http
130136
containerPort: {{ .Values.service.port }}
131137
protocol: TCP
138+
{{- if $workerJmx.enabled }}
139+
- name: jmx-registry
140+
containerPort: {{ $workerJmx.registryPort }}
141+
protocol: TCP
142+
- name: jmx-server
143+
containerPort: {{ $workerJmx.serverPort }}
144+
protocol: TCP
145+
{{- end }}
132146
{{- range $key, $value := .Values.worker.additionalExposedPorts }}
133147
- name: {{ $value.name }}
134148
containerPort: {{ $value.port }}
@@ -155,6 +169,25 @@ spec:
155169
{{- toYaml .Values.worker.lifecycle | nindent 12 }}
156170
resources:
157171
{{- toYaml .Values.worker.resources | nindent 12 }}
172+
{{- if $workerJmx.exporter.enabled }}
173+
- name: jmx-exporter
174+
image: {{ $workerJmx.exporter.image }}
175+
imagePullPolicy: {{ $workerJmx.exporter.pullPolicy }}
176+
securityContext:
177+
{{- toYaml $workerJmx.exporter.securityContext | nindent 12 }}
178+
args:
179+
- "{{ $workerJmx.exporter.port }}"
180+
- /etc/jmx-exporter/jmx-exporter-config.yaml
181+
volumeMounts:
182+
- mountPath: /etc/jmx-exporter/
183+
name: jmx-exporter-config-volume
184+
resources:
185+
{{- toYaml $workerJmx.exporter.resources | nindent 12 }}
186+
ports:
187+
- name: jmx-exporter
188+
containerPort: {{ $workerJmx.exporter.port }}
189+
protocol: TCP
190+
{{- end }}
158191
{{- if .Values.sidecarContainers.worker }}
159192
{{- toYaml .Values.sidecarContainers.worker | nindent 8 }}
160193
{{- end }}

charts/trino/templates/service.yaml renamed to charts/trino/templates/service-coordinator.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
{{- $coordinatorJmx := merge .Values.jmx.coordinator (omit .Values.jmx "coordinator" "worker") -}}
12
apiVersion: v1
23
kind: Service
34
metadata:
45
name: {{ template "trino.fullname" . }}
56
namespace: {{ .Release.Namespace }}
67
labels:
78
{{- include "trino.labels" . | nindent 4 }}
9+
app.kubernetes.io/component: coordinator
810
annotations:
911
{{- toYaml .Values.service.annotations | nindent 4 }}
1012
spec:
@@ -17,8 +19,8 @@ spec:
1719
{{- if .Values.service.nodePort }}
1820
nodePort: {{ .Values.service.nodePort }}
1921
{{- end }}
20-
{{- if .Values.jmx.exporter.enabled }}
21-
- port: {{ .Values.jmx.exporter.port }}
22+
{{- if $coordinatorJmx.exporter.enabled }}
23+
- port: {{ $coordinatorJmx.exporter.port }}
2224
targetPort: jmx-exporter
2325
protocol: TCP
2426
name: jmx-exporter
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{- $workerJmx := merge .Values.jmx.worker (omit .Values.jmx "coordinator" "worker") -}}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ template "trino.fullname" . }}-worker
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "trino.labels" . | nindent 4 }}
9+
app.kubernetes.io/component: worker
10+
annotations:
11+
{{- toYaml .Values.service.annotations | nindent 4 }}
12+
spec:
13+
clusterIP: None
14+
ports:
15+
- port: {{ .Values.service.port }}
16+
targetPort: http
17+
protocol: TCP
18+
name: http
19+
{{- if $workerJmx.exporter.enabled }}
20+
- port: {{$workerJmx.exporter.port }}
21+
targetPort: jmx-exporter
22+
protocol: TCP
23+
name: jmx-exporter
24+
{{- end }}
25+
selector:
26+
{{- include "trino.selectorLabels" . | nindent 4 }}
27+
app.kubernetes.io/component: worker
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
{{- if .Values.serviceMonitor.enabled -}}
1+
{{- $coordinatorServiceMonitor := merge .Values.serviceMonitor.coordinator (omit .Values.serviceMonitor "coordinator" "worker") -}}
2+
{{- if $coordinatorServiceMonitor.enabled -}}
23
apiVersion: monitoring.coreos.com/v1
34
kind: ServiceMonitor
45
metadata:
56
name: {{ template "trino.fullname" . }}
67
namespace: {{ .Release.Namespace }}
78
labels:
89
{{- include "trino.labels" . | nindent 4 }}
9-
{{- if .Values.serviceMonitor.labels }}
10-
{{- toYaml .Values.serviceMonitor.labels | nindent 4 }}
10+
{{- if $coordinatorServiceMonitor.labels }}
11+
{{- toYaml $coordinatorServiceMonitor.labels | nindent 4 }}
1112
{{- end }}
1213
spec:
1314
selector:
1415
matchLabels:
1516
{{- include "trino.selectorLabels" . | nindent 6 }}
17+
app.kubernetes.io/component: coordinator
1618
namespaceSelector:
1719
matchNames:
1820
- {{ .Release.Namespace }}
1921
endpoints:
2022
- port: jmx-exporter
21-
interval: {{ .Values.serviceMonitor.interval }}
23+
interval: {{ $coordinatorServiceMonitor.interval }}
2224
{{- end }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{- $workerServiceMonitor := merge .Values.serviceMonitor.worker (omit .Values.serviceMonitor "coordinator" "worker") -}}
2+
{{- if $workerServiceMonitor.enabled }}
3+
apiVersion: monitoring.coreos.com/v1
4+
kind: ServiceMonitor
5+
metadata:
6+
name: {{ template "trino.fullname" . }}-worker
7+
namespace: {{ .Release.Namespace }}
8+
labels:
9+
{{- include "trino.labels" . | nindent 4 }}
10+
{{- if $workerServiceMonitor.labels }}
11+
{{- toYaml $workerServiceMonitor.labels | nindent 4 }}
12+
{{- end }}
13+
spec:
14+
selector:
15+
matchLabels:
16+
{{- include "trino.selectorLabels" . | nindent 6 }}
17+
app.kubernetes.io/component: worker
18+
namespaceSelector:
19+
matchNames:
20+
- {{ .Release.Namespace }}
21+
endpoints:
22+
- port: jmx-exporter
23+
interval: {{ $workerServiceMonitor.interval }}
24+
{{- end }}

0 commit comments

Comments
 (0)