Skip to content

Commit

Permalink
fix: moved JMX Exporter container port to correct container
Browse files Browse the repository at this point in the history
fix: converted .Values.jmx.exporter.configProperties to templated multiline string
  • Loading branch information
sdaberdaku committed Sep 19, 2024
1 parent d52941b commit f4cb34d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
5 changes: 3 additions & 2 deletions charts/trino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,13 @@ Fast distributed SQL query engine for big data analytics that helps you explore
* `jmx.exporter.image` - string, default: `"bitnami/jmx-exporter:latest"`
* `jmx.exporter.pullPolicy` - string, default: `"Always"`
* `jmx.exporter.port` - int, default: `5556`
* `jmx.exporter.configProperties` - list, default: `[]`
* `jmx.exporter.configProperties` - string, default: `""`

JMX Config Properties is mounted to /etc/jmx-exporter/jmx-exporter-config.yaml
The string value is templated using `tpl`. JMX Config Properties is mounted to /etc/jmx-exporter/jmx-exporter-config.yaml
Example:
```yaml
configProperties: |-
hostPort: localhost:{{- .Values.jmx.registryPort }}
startDelaySeconds: 0
ssl: false
lowercaseOutputName: false
Expand Down
12 changes: 7 additions & 5 deletions charts/trino/templates/configmap-jmx-exporter.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{{- if .Values.jmx.exporter.enabled -}}
{{- with .Values.jmx.exporter }}
{{- if .enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "trino.fullname" . }}-jmx-exporter-config
namespace: {{ .Release.Namespace }}
name: {{ template "trino.fullname" $ }}-jmx-exporter-config
namespace: {{ $.Release.Namespace }}
labels:
{{- include "trino.labels" . | nindent 4 }}
{{- include "trino.labels" $ | nindent 4 }}
app.kubernetes.io/component: jmx
data:
jmx-exporter-config.yaml: |-
{{- .Values.jmx.exporter.configProperties | nindent 4 }}
{{- tpl .configProperties $ | nindent 4 }}
{{- end }}
{{- end }}
31 changes: 18 additions & 13 deletions charts/trino/templates/deployment-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,15 @@ spec:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
{{- if .Values.jmx.enabled }}
{{- with .Values.jmx }}
{{- if .enabled }}
- name: jmx-registry
containerPort: {{ .Values.jmx.registryPort }}
containerPort: {{ .registryPort }}
protocol: TCP
- name: jmx-server
containerPort: {{ .Values.jmx.serverPort }}
containerPort: {{ .serverPort }}
protocol: TCP
{{- end }}
{{- if .Values.jmx.exporter.enabled }}
- name: jmx-exporter
containerPort: {{ .Values.jmx.exporter.port }}
protocol: TCP
{{- end }}
{{- range $key, $value := .Values.coordinator.additionalExposedPorts }}
- name: {{ $value.name }}
Expand Down Expand Up @@ -201,22 +198,30 @@ spec:
{{- toYaml .Values.coordinator.lifecycle | nindent 12 }}
resources:
{{- toYaml .Values.coordinator.resources | nindent 12 }}
{{- if .Values.jmx.exporter.enabled }}
{{- with .Values.jmx.exporter }}
{{- if .enabled }}
- name: jmx-exporter
image: {{ .Values.jmx.exporter.image }}
imagePullPolicy: {{ .Values.jmx.exporter.pullPolicy }}
{{- with .Values.jmx.exporter.securityContext }}
image: {{ .image }}
imagePullPolicy: {{ .pullPolicy }}
{{- with .securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
args:
- "{{ .Values.jmx.exporter.port }}"
- "{{ .port }}"
- /etc/jmx-exporter/jmx-exporter-config.yaml
volumeMounts:
- mountPath: /etc/jmx-exporter/
name: jmx-exporter-config-volume
{{- with .resources }}
resources:
{{- toYaml .Values.jmx.exporter.resources | nindent 12 }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: jmx-exporter
containerPort: {{ .port }}
protocol: TCP
{{- end }}
{{- end }}
{{- if .Values.sidecarContainers.coordinator }}
{{- toYaml .Values.sidecarContainers.coordinator | nindent 8 }}
Expand Down
7 changes: 4 additions & 3 deletions charts/trino/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -761,13 +761,13 @@ jmx:
image: bitnami/jmx-exporter:latest
pullPolicy: Always
port: 5556
configProperties: []
securityContext: {}
# jmx.exporter.configProperties -- JMX Config Properties is mounted to /etc/jmx-exporter/jmx-exporter-config.yaml
configProperties: ""
# jmx.exporter.configProperties -- The string value is templated using `tpl`. JMX Config Properties is mounted to /etc/jmx-exporter/jmx-exporter-config.yaml
# @raw
# Example:
# ```yaml
# configProperties: |-
# hostPort: localhost:{{- .Values.jmx.registryPort }}
# startDelaySeconds: 0
# ssl: false
# lowercaseOutputName: false
Expand All @@ -786,6 +786,7 @@ jmx:
# value: '$2'
# help: 'ThreadCount (java.lang<type=Threading><>ThreadCount)'
# type: UNTYPED
securityContext: {}
resources: {}
# jmx.exporter.resources -- It is recommended not to specify default resources
# and to leave this as a conscious choice for the user. This also increases
Expand Down

0 comments on commit f4cb34d

Please sign in to comment.