Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(monitoring): Add optional ServiceMonitors to all JVM based services #181

Merged
merged 11 commits into from
Oct 11, 2022
10 changes: 5 additions & 5 deletions charts/datahub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ description: A Helm chart for LinkedIn DataHub
type: application
# 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.106
version: 0.2.107
# 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.8.45
dependencies:
- name: datahub-gms
version: 0.2.9
version: 0.2.10
repository: file://./subcharts/datahub-gms
condition: datahub-gms.enabled
- name: datahub-frontend
version: 0.2.9
version: 0.2.10
repository: file://./subcharts/datahub-frontend
condition: datahub-frontend.enabled
- name: datahub-mae-consumer
version: 0.2.7
version: 0.2.8
repository: file://./subcharts/datahub-mae-consumer
condition: global.datahub_standalone_consumers_enabled
- name: datahub-mce-consumer
version: 0.2.8
version: 0.2.9
repository: file://./subcharts/datahub-mce-consumer
condition: global.datahub_standalone_consumers_enabled
- name: datahub-ingestion-cron
Expand Down
2 changes: 1 addition & 1 deletion charts/datahub/subcharts/datahub-frontend/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application

# 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.9
version: 0.2.10

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
1 change: 1 addition & 0 deletions charts/datahub/subcharts/datahub-frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Current chart version is `0.2.0`
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `nil` | |
| serviceMonitoring.create | bool | `false` | If set true and `global.datahub.monitoring.enablePrometheus` is set `true` it will create a ServiceMonitor resource |
| tolerations | list | `[]` | |
| global.elasticsearch.host | string | `"elasticsearch"` | |
| global.elasticsearch.port | string | `"9200"` | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ spec:
defaultMode: 0444
secretName: {{ .name }}
{{- end }}
{{- if .Values.exporters.jmx.enabled }}
- name: config-jmx-exporter
configMap:
name: {{ include "datahub-gms.fullname" . }}-config-jmx-exporter
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@ spec:
nodePort: {{ . }}
{{- end }}
{{- end }}
{{- if .Values.global.datahub.monitoring.enablePrometheus }}
- name: jmx
port: 4318
targetPort: jmx
protocol: TCP
{{- end }}
selector:
{{- include "datahub-frontend.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if and .Values.serviceMonitor.create .Values.global.datahub.monitoring.enablePrometheus -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ printf "%s-%s" .Release.Name "datahub-frontend" }}
labels:
{{- include "datahub-frontend.labels" . | nindent 4 }}
{{- with .Values.serviceMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: jmx
relabelings:
- separator: /
sourceLabels:
- namespace
- pod
targetLabel: instance
selector:
matchLabels:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: datahub-frontend
{{- end -}}
3 changes: 3 additions & 0 deletions charts/datahub/subcharts/datahub-frontend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ service:
annotations: {}
# service.beta.kubernetes.io/aws-load-balancer-internal: "true"

serviceMonitor:
create: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we create service monitors by default since they only get activated if and only if global.datahub.monitoring.enablePrometheus is also enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if they don't have serviceMonitor CRD, the deployment would fail. It's an advanced feature, if somebody know what they are doing, then they can enable.


ingress:
# className: ""
enabled: false
Expand Down
2 changes: 1 addition & 1 deletion charts/datahub/subcharts/datahub-gms/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application

# 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.9
version: 0.2.10

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
1 change: 1 addition & 0 deletions charts/datahub/subcharts/datahub-gms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Current chart version is `0.2.0`
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `nil` | |
| serviceMonitoring.create | bool | `false` | If set true and `global.datahub.monitoring.enablePrometheus` is set `true` it will create a ServiceMonitor resource |
| tolerations | list | `[]` | |
| datahub.metadata_service_authentication.enabled | bool | `false` | Whether Metadata Service Authentication is enabled. |
| global.datahub.metadata_service_authentication.systemClientId | string | `"__datahub_system"` | The internal system id that is used to communicate with DataHub GMS. Required if metadata_service_authentication is 'true'. |
Expand Down
6 changes: 6 additions & 0 deletions charts/datahub/subcharts/datahub-gms/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@ spec:
nodePort: {{ . }}
{{- end }}
{{- end }}
{{- if .Values.global.datahub.monitoring.enablePrometheus }}
- name: jmx
port: 4318
targetPort: jmx
protocol: TCP
{{- end }}
selector:
{{- include "datahub-gms.selectorLabels" . | nindent 4 }}
25 changes: 25 additions & 0 deletions charts/datahub/subcharts/datahub-gms/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if and .Values.serviceMonitor.create .Values.global.datahub.monitoring.enablePrometheus -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ printf "%s-%s" .Release.Name "datahub-gms" }}
labels:
{{- include "datahub-gms.labels" . | nindent 4 }}
{{- with .Values.serviceMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: jmx
relabelings:
- separator: /
sourceLabels:
- namespace
- pod
targetLabel: instance
selector:
matchLabels:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: datahub-gms
{{- end -}}
4 changes: 4 additions & 0 deletions charts/datahub/subcharts/datahub-gms/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name:

serviceMonitor:
create: false


podAnnotations: {}
# co.elastic.logs/enabled: "true"

Expand Down
2 changes: 1 addition & 1 deletion charts/datahub/subcharts/datahub-mae-consumer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application

# 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.7
version: 0.2.8

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
1 change: 1 addition & 0 deletions charts/datahub/subcharts/datahub-mae-consumer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Current chart version is `0.2.0`
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `nil` | |
| serviceMonitoring.create | bool | `false` | If set true and `global.datahub.monitoring.enablePrometheus` is set `true` it will create a ServiceMonitor resource |
| tolerations | list | `[]` | |
| datahub.metadata_service_authentication.enabled | bool | `false` | Whether Metadata Service Authentication is enabled. |
| global.datahub.metadata_service_authentication.systemClientId | string | `"__datahub_system"` | The internal system id that is used to communicate with DataHub GMS. Required if metadata_service_authentication is 'true'. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ spec:
defaultMode: 0444
secretName: {{ .name }}
{{- end }}
{{- if .Values.exporters.jmx.enabled }}
- name: config-jmx-exporter
configMap:
name: {{ include "datahub-mae-consumer.fullname" . }}-config-jmx-exporter
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ spec:
nodePort: {{ . }}
{{- end }}
{{- end }}
{{- if .Values.global.datahub.monitoring.enablePrometheus }}
- name: jmx
port: 4318
targetPort: jmx
protocol: TCP
{{- end }}
selector:
{{- include "datahub-mae-consumer.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if and .Values.serviceMonitor.create .Values.global.datahub.monitoring.enablePrometheus -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ printf "%s-%s" .Release.Name "datahub-mae-consumer" }}
labels:
{{- include "datahub-mae-consumer.labels" . | nindent 4 }}
{{- with .Values.serviceMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: jmx
relabelings:
- separator: /
sourceLabels:
- namespace
- pod
targetLabel: instance
selector:
matchLabels:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: datahub-mae-consumer
{{- end -}}
3 changes: 3 additions & 0 deletions charts/datahub/subcharts/datahub-mae-consumer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name:

serviceMonitor:
create: false

podAnnotations: {}
# co.elastic.logs/enabled: "true"

Expand Down
2 changes: 1 addition & 1 deletion charts/datahub/subcharts/datahub-mce-consumer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application

# 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.8
version: 0.2.9

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
1 change: 1 addition & 0 deletions charts/datahub/subcharts/datahub-mce-consumer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Current chart version is `0.2.0`
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `nil` | |
| serviceMonitoring.create | bool | `false` | If set true and `global.datahub.monitoring.enablePrometheus` is set `true` it will create a ServiceMonitor resource |
| tolerations | list | `[]` | |
| datahub.metadata_service_authentication.enabled | bool | `false` | Whether Metadata Service Authentication is enabled. |
| global.datahub.metadata_service_authentication.systemClientId | string | `"__datahub_system"` | The internal system id that is used to communicate with DataHub GMS. Required if metadata_service_authentication is 'true'. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ spec:
defaultMode: 0444
secretName: {{ .Values.global.credentialsAndCertsSecrets.name }}
{{- end }}
{{- if .Values.exporters.jmx.enabled }}
- name: config-jmx-exporter
configMap:
name: {{ include "datahub-mce-consumer.fullname" . }}-config-jmx-exporter
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -59,6 +54,9 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: actuator
containerPort: 9090
protocol: TCP
{{- if or .Values.global.datahub.monitoring.enablePrometheus .Values.global.datahub.monitoring.enableJMXPort }}
- name: jmx
containerPort: 4318
Expand All @@ -67,14 +65,14 @@ spec:
livenessProbe:
httpGet:
path: /actuator/health
port: 9090
port: actuator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also review Mae-consumer deployment.yaml?
The liveness and readiness probes are using http port

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same thing is exposed on 9091 on MAE, and called http, I called it actuator, because http is less descirptive.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it consistent then? Call all of them actuator

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed this one to http

initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
readinessProbe:
httpGet:
path: /actuator/health
port: 9090
port: actuator
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-%s" .Release.Name "datahub-mce-consumer" }}
labels:
{{- include "datahub-mce-consumer.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
protocol: {{ .Values.service.protocol }}
name: {{ .Values.service.name }}
{{- if eq .Values.service.type "NodePort" }}
{{- with .Values.service.nodePort }}
nodePort: {{ . }}
{{- end }}
{{- end }}
{{- if .Values.global.datahub.monitoring.enablePrometheus }}
- name: jmx
port: 4318
targetPort: jmx
protocol: TCP
{{- end }}
selector:
{{- include "datahub-mce-consumer.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if and .Values.serviceMonitor.create .Values.global.datahub.monitoring.enablePrometheus -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ printf "%s-%s" .Release.Name "datahub-mce-consumer" }}
labels:
{{- include "datahub-mce-consumer.labels" . | nindent 4 }}
{{- with .Values.serviceMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: jmx
relabelings:
- separator: /
sourceLabels:
- namespace
- pod
targetLabel: instance
selector:
matchLabels:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: datahub-mce-consumer
{{- end -}}
13 changes: 11 additions & 2 deletions charts/datahub/subcharts/datahub-mce-consumer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name:

serviceAccount:
create: false

podAnnotations: {}
# co.elastic.logs/enabled: "true"

Expand All @@ -39,8 +42,14 @@ securityContext: {}
# runAsUser: 1000

service:
type: ClusterIP
port: 80
type: ClusterIP # NodePort
port: "9090"
targetPort: actuator
Copy link
Contributor

@pedro93 pedro93 Oct 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this for mce-consumer? Mae-consumer does not have it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it already has it. MCE was missing the service for some reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAE has the service but in the values.yaml it is using a different port and a different targetPort name, I'm asking if we can make this consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed it to http for consistency

protocol: TCP
name: actuator

serviceMonitor:
create: false

ingress:
enabled: false
Expand Down