Skip to content

Commit

Permalink
feat(Kubernetes): Add JMX exporter containers to all DataHub componen…
Browse files Browse the repository at this point in the history
…ts (datahub-project#2251)


Co-authored-by: Ricardo Bernardino <[email protected]>
  • Loading branch information
bernardino and Ricardo Bernardino authored Mar 31, 2021
1 parent a5b206a commit 9a94794
Show file tree
Hide file tree
Showing 24 changed files with 355 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Current chart version is `0.2.0`
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| datahub.play.mem.buffer.size | string | `"10MB"` | |
| exporters.jmx.enabled | boolean | false | |
| extraEnvs | Extra [environment variables][] which will be appended to the `env:` definition for the container | `[]` |
| extraVolumes | Templatable string of additional `volumes` to be passed to the `tpl` function | "" |
| extraVolumeMounts | Templatable string of additional `volumeMounts` to be passed to the `tpl` function | "" |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.exporters.jmx.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "datahub-frontend.fullname" . }}-config-jmx-exporter
labels:
{{- include "datahub-frontend.labels" . | nindent 4 }}
data:
config.yml: |-
hostPort: localhost:{{ .Values.env.JMXPORT }}
lowercaseOutputName: {{ .Values.exporters.jmx.config.lowercaseOutputName }}
lowercaseOutputLabelNames: {{ .Values.exporters.jmx.config.lowercaseOutputLabelNames }}
rules:
{{ .Values.exporters.jmx.config.rules | toYaml | indent 6 }}
ssl: false
startDelaySeconds: {{ .Values.exporters.jmx.config.startDelaySeconds }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ spec:
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- if .Values.exporters.jmx.enabled }}
- name: config-jmx-exporter
configMap:
name: {{ include "datahub-frontend.fullname" . }}-config-jmx-exporter
{{- end }}
initContainers:
{{- if .Values.extraInitContainers }}
{{- .Values.extraInitContainers | toYaml | nindent 6 }}
Expand Down Expand Up @@ -74,6 +79,9 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}

{{- include "datahub-jmxexporter.container" . }}

{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
46 changes: 46 additions & 0 deletions contrib/kubernetes/datahub/charts/datahub-frontend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,52 @@ tolerations: []

affinity: {}

env:
JMXPORT: 1099

exporters:
jmx:
enabled: false
# image:
# repository: bitnami/jmx-exporter
# tag: 0.15.0
# pullPolicy: IfNotPresent
# config:
# lowercaseOutputName: true
# lowercaseOutputLabelNames: true
# rules:
# - pattern: ".*"
# startDelaySeconds: 30
# env: {}
# resources: {}
# path: /metrics
# ports:
# jmxxp:
# containerPort: 5556
# protocol: TCP
# livenessProbe:
# httpGet:
# path: /metrics
# port: jmxxp
# initialDelaySeconds: 30
# periodSeconds: 15
# timeoutSeconds: 60
# failureThreshold: 8
# successThreshold: 1
# readinessProbe:
# httpGet:
# path: /metrics
# port: jmxxp
# initialDelaySeconds: 30
# periodSeconds: 15
# timeoutSeconds: 60
# failureThreshold: 8
# successThreshold: 1
# serviceMonitor:
# interval: 30s
# scrapeTimeout: 30s
# scheme: http

datahub:
play:
mem:
Expand Down
1 change: 1 addition & 0 deletions contrib/kubernetes/datahub/charts/datahub-gms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Current chart version is `0.2.0`
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| exporters.jmx.enabled | boolean | false | |
| extraEnvs | Extra [environment variables][] which will be appended to the `env:` definition for the container | `[]` |
| extraVolumes | Templatable string of additional `volumes` to be passed to the `tpl` function | "" |
| extraVolumeMounts | Templatable string of additional `volumeMounts` to be passed to the `tpl` function | "" |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.exporters.jmx.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "datahub-gms.fullname" . }}-config-jmx-exporter
labels:
{{- include "datahub-gms.labels" . | nindent 4 }}
data:
config.yml: |-
hostPort: localhost:{{ .Values.env.JMXPORT }}
lowercaseOutputName: {{ .Values.exporters.jmx.config.lowercaseOutputName }}
lowercaseOutputLabelNames: {{ .Values.exporters.jmx.config.lowercaseOutputLabelNames }}
rules:
{{ .Values.exporters.jmx.config.rules | toYaml | indent 6 }}
ssl: false
startDelaySeconds: {{ .Values.exporters.jmx.config.startDelaySeconds }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ spec:
defaultMode: 256
secretName: {{ .Values.global.credentialsAndCertsSecrets.name }}
{{- end }}
{{- if .Values.exporters.jmx.enabled }}
- name: config-jmx-exporter
configMap:
name: {{ include "datahub-gms.fullname" . }}-config-jmx-exporter
{{- end }}
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -114,6 +119,9 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}

{{- include "datahub-jmxexporter.container" . }}

{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
45 changes: 45 additions & 0 deletions contrib/kubernetes/datahub/charts/datahub-gms/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,51 @@ tolerations: []

affinity: {}

env:
JMXPORT: 1099

exporters:
jmx:
enabled: false
# image:
# repository: bitnami/jmx-exporter
# tag: 0.15.0
# pullPolicy: IfNotPresent
# config:
# lowercaseOutputName: true
# rules:
# - pattern: ".*"
# startDelaySeconds: 30
# env: {}
# resources: {}
# path: /metrics
# ports:
# jmxxp:
# containerPort: 5556
# protocol: TCP
# livenessProbe:
# httpGet:
# path: /metrics
# port: jmxxp
# initialDelaySeconds: 30
# periodSeconds: 15
# timeoutSeconds: 60
# failureThreshold: 8
# successThreshold: 1
# readinessProbe:
# httpGet:
# path: /metrics
# port: jmxxp
# initialDelaySeconds: 30
# periodSeconds: 15
# timeoutSeconds: 60
# failureThreshold: 8
# successThreshold: 1
# serviceMonitor:
# interval: 30s
# scrapeTimeout: 30s
# scheme: http

#This section is useful if we are installing this chart separately for testing
# helm install datahub-gms datahub-gms/
global:
Expand Down
21 changes: 21 additions & 0 deletions contrib/kubernetes/datahub/charts/datahub-jmxexporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: datahub-jmxexporter
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: library

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 0.2.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.3.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- define "datahub-jmxexporter.container" -}}
{{- if .Values.exporters.jmx.enabled }}
- name: jmx-exporter
image: "{{ .Values.exporters.jmx.image.repository }}:{{ .Values.exporters.jmx.image.tag }}"
imagePullPolicy: {{ .Values.exporters.jmx.image.pullPolicy }}
args: ["{{ .Values.exporters.jmx.ports.jmxxp.containerPort}}", "/opt/jmx_exporter/config.yml"]
ports:
{{- range $key, $port := .Values.exporters.jmx.ports }}
- name: {{ $key }}
{{ toYaml $port | indent 14 }}
{{- end }}
livenessProbe:
{{ toYaml .Values.exporters.jmx.livenessProbe | indent 12 }}
readinessProbe:
{{ toYaml .Values.exporters.jmx.readinessProbe | indent 12 }}
env:
- name: SERVICE_PORT
value: {{ .Values.exporters.jmx.ports.jmxxp.containerPort | quote }}
{{- with .Values.exporters.jmx.env }}
{{- range $key, $value := . }}
- name: {{ $key | upper | replace "." "_" }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
resources:
{{ toYaml .Values.exporters.jmx.resources | indent 12 }}
volumeMounts:
- name: config-jmx-exporter
mountPath: /opt/jmx_exporter/config.yml
subPath: config.yml
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Current chart version is `0.2.0`
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| exporters.jmx.enabled | boolean | false | |
| extraEnvs | Extra [environment variables][] which will be appended to the `env:` definition for the container | `[]` |
| extraVolumes | Templatable string of additional `volumes` to be passed to the `tpl` function | "" |
| extraVolumeMounts | Templatable string of additional `volumeMounts` to be passed to the `tpl` function | "" |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.exporters.jmx.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "datahub-mae-consumer.fullname" . }}-config-jmx-exporter
labels:
{{- include "datahub-mae-consumer.labels" . | nindent 4 }}
data:
config.yml: |-
hostPort: localhost:{{ .Values.env.JMXPORT }}
lowercaseOutputName: {{ .Values.exporters.jmx.config.lowercaseOutputName }}
lowercaseOutputLabelNames: {{ .Values.exporters.jmx.config.lowercaseOutputLabelNames }}
rules:
{{ .Values.exporters.jmx.config.rules | toYaml | indent 6 }}
ssl: false
startDelaySeconds: {{ .Values.exporters.jmx.config.startDelaySeconds }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ spec:
defaultMode: 256
secretName: {{ .Values.global.credentialsAndCertsSecrets.name }}
{{- end }}
{{- if .Values.exporters.jmx.enabled }}
- name: config-jmx-exporter
configMap:
name: {{ include "datahub-mae-consumer.fullname" . }}-config-jmx-exporter
{{- end }}
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -97,6 +102,9 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}

{{- include "datahub-jmxexporter.container" . }}

{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
45 changes: 45 additions & 0 deletions contrib/kubernetes/datahub/charts/datahub-mae-consumer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,51 @@ tolerations: []

affinity: {}

env:
JMXPORT: 1099

exporters:
jmx:
enabled: false
# image:
# repository: bitnami/jmx-exporter
# tag: 0.15.0
# pullPolicy: IfNotPresent
# config:
# lowercaseOutputName: true
# rules:
# - pattern: ".*"
# startDelaySeconds: 30
# env: {}
# resources: {}
# path: /metrics
# ports:
# jmxxp:
# containerPort: 5556
# protocol: TCP
# livenessProbe:
# httpGet:
# path: /metrics
# port: jmxxp
# initialDelaySeconds: 30
# periodSeconds: 15
# timeoutSeconds: 60
# failureThreshold: 8
# successThreshold: 1
# readinessProbe:
# httpGet:
# path: /metrics
# port: jmxxp
# initialDelaySeconds: 30
# periodSeconds: 15
# timeoutSeconds: 60
# failureThreshold: 8
# successThreshold: 1
# serviceMonitor:
# interval: 30s
# scrapeTimeout: 30s
# scheme: http

global:
elasticsearch:
host: "elasticsearch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Current chart version is `0.2.0`
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| exporters.jmx.enabled | boolean | false | |
| extraEnvs | Extra [environment variables][] which will be appended to the `env:` definition for the container | `[]` |
| extraVolumes | Templatable string of additional `volumes` to be passed to the `tpl` function | "" |
| extraVolumeMounts | Templatable string of additional `volumeMounts` to be passed to the `tpl` function | "" |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.exporters.jmx.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "datahub-mce-consumer.fullname" . }}-config-jmx-exporter
labels:
{{- include "datahub-mce-consumer.labels" . | nindent 4 }}
data:
config.yml: |-
hostPort: localhost:{{ .Values.env.JMXPORT }}
lowercaseOutputName: {{ .Values.exporters.jmx.config.lowercaseOutputName }}
lowercaseOutputLabelNames: {{ .Values.exporters.jmx.config.lowercaseOutputLabelNames }}
rules:
{{ .Values.exporters.jmx.config.rules | toYaml | indent 6 }}
ssl: false
startDelaySeconds: {{ .Values.exporters.jmx.config.startDelaySeconds }}
{{- end }}
Loading

0 comments on commit 9a94794

Please sign in to comment.