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

[Feature-14542][K8S] add prometheus serviceMonitor #14539

Merged
merged 5 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ spec:
ports:
- containerPort: 5678
name: "master-port"
- containerPort: 5679
name: "actuator-port"
env:
- name: TZ
value: {{ .Values.timezone }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ spec:
ports:
- containerPort: 1234
name: "worker-port"
- containerPort: 1235
name: "actuator-port"
env:
- name: TZ
value: {{ .Values.timezone }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "dolphinscheduler.fullname" . }}-alert
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-alert
{{- include "dolphinscheduler.common.labels" . | nindent 4 }}
{{- if .Values.alert.service.annotations }}
annotations: {{- toYaml .Values.alert.service.annotations | nindent 4 }}
{{- end }}
spec:
ports:
- port: 50052
Expand All @@ -33,3 +37,33 @@ spec:
name: actuator-port
selector:
{{- include "dolphinscheduler.alert.labels" . | nindent 4 }}

---
{{- if .Values.alert.service.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "dolphinscheduler.fullname" . }}-alert
namespace: {{ .Release.Namespace }}
labels:
{{- include "dolphinscheduler.common.labels" . | nindent 4 }}
{{- if .Values.alert.service.serviceMonitor.labels }}
{{- toYaml .Values.alert.service.serviceMonitor.labels | nindent 4 }}
{{- end }}
{{- if .Values.alert.service.serviceMonitor.annotations }}
annotations: {{- toYaml .Values.alert.service.serviceMonitor.annotations | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Values.alert.service.serviceMonitor.namespace | default .Release.Namespace }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-alert
{{- include "dolphinscheduler.common.labels" . | nindent 6 }}
endpoints:
- scheme: http
targetPort: actuator-port
path: {{ .Values.alert.service.serviceMonitor.path }}
interval: {{ .Values.alert.service.serviceMonitor.interval }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ metadata:
labels:
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api
{{- include "dolphinscheduler.common.labels" . | nindent 4 }}
{{- if and (eq .Values.api.service.type "LoadBalancer") .Values.api.service.annotations }}
annotations:
{{- range $key, $value := .Values.api.service.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- if .Values.api.service.annotations }}
annotations: {{- toYaml .Values.api.service.annotations | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.api.service.type }}
Expand Down Expand Up @@ -59,3 +56,33 @@ spec:
{{- end }}
selector:
{{- include "dolphinscheduler.api.labels" . | nindent 4 }}

---
{{- if .Values.api.service.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "dolphinscheduler.fullname" . }}-api
namespace: {{ .Release.Namespace }}
labels:
{{- include "dolphinscheduler.common.labels" . | nindent 4 }}
{{- if .Values.api.service.serviceMonitor.labels }}
{{- toYaml .Values.api.service.serviceMonitor.labels | nindent 4 }}
{{- end }}
{{- if .Values.api.service.serviceMonitor.annotations }}
annotations: {{- toYaml .Values.api.service.serviceMonitor.annotations | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Values.api.service.serviceMonitor.namespace | default .Release.Namespace }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api
{{- include "dolphinscheduler.common.labels" . | nindent 6 }}
endpoints:
- scheme: http
targetPort: api-port
path: {{ .Values.api.service.serviceMonitor.path }}
interval: {{ .Values.api.service.serviceMonitor.interval }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,49 @@ metadata:
labels:
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-master-headless
{{- include "dolphinscheduler.common.labels" . | nindent 4 }}
{{- if .Values.master.service.annotations }}
annotations: {{- toYaml .Values.master.service.annotations | nindent 4 }}
{{- end }}
spec:
clusterIP: "None"
ports:
- port: 5678
targetPort: master-port
protocol: TCP
name: master-port
- port: 5679
targetPort: actuator-port
protocol: TCP
name: actuator-port
selector:
{{- include "dolphinscheduler.master.labels" . | nindent 4 }}

---
{{- if .Values.master.service.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "dolphinscheduler.fullname" . }}-master
namespace: {{ .Release.Namespace }}
labels:
{{- include "dolphinscheduler.common.labels" . | nindent 4 }}
{{- if .Values.master.service.serviceMonitor.labels }}
{{- toYaml .Values.master.service.serviceMonitor.labels | nindent 4 }}
{{- end }}
{{- if .Values.master.service.serviceMonitor.annotations }}
annotations: {{- toYaml .Values.master.service.serviceMonitor.annotations | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Values.master.service.serviceMonitor.namespace | default .Release.Namespace }}
selector:
{{- include "dolphinscheduler.master.labels" . | nindent 4 }}
matchLabels:
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-master-headless
{{- include "dolphinscheduler.common.labels" . | nindent 6 }}
endpoints:
- scheme: http
targetPort: actuator-port
path: {{ .Values.master.service.serviceMonitor.path }}
interval: {{ .Values.master.service.serviceMonitor.interval }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,49 @@ metadata:
labels:
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-worker-headless
{{- include "dolphinscheduler.common.labels" . | nindent 4 }}
{{- if .Values.worker.service.annotations }}
annotations: {{- toYaml .Values.worker.service.annotations | nindent 4 }}
{{- end }}
spec:
clusterIP: "None"
ports:
- port: 1234
targetPort: worker-port
protocol: TCP
name: worker-port
- port: 1235
targetPort: actuator-port
protocol: TCP
name: actuator-port
selector:
{{- include "dolphinscheduler.worker.labels" . | nindent 4 }}

---
{{- if .Values.worker.service.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "dolphinscheduler.fullname" . }}-worker
namespace: {{ .Release.Namespace }}
labels:
{{- include "dolphinscheduler.common.labels" . | nindent 4 }}
{{- if .Values.worker.service.serviceMonitor.labels }}
{{- toYaml .Values.worker.service.serviceMonitor.labels | nindent 4 }}
{{- end }}
{{- if .Values.worker.service.serviceMonitor.annotations }}
annotations: {{- toYaml .Values.worker.service.serviceMonitor.annotations | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Values.worker.service.serviceMonitor.namespace | default .Release.Namespace }}
selector:
{{- include "dolphinscheduler.worker.labels" . | nindent 4 }}
matchLabels:
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-worker-headless
{{- include "dolphinscheduler.common.labels" . | nindent 6 }}
endpoints:
- scheme: http
targetPort: actuator-port
path: {{ .Values.worker.service.serviceMonitor.path }}
interval: {{ .Values.worker.service.serviceMonitor.interval }}
{{- end }}
58 changes: 58 additions & 0 deletions deploy/kubernetes/dolphinscheduler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,21 @@ master:
MASTER_RESERVED_MEMORY: "0.3"
MASTER_FAILOVER_INTERVAL: "10m"
MASTER_KILL_APPLICATION_WHEN_HANDLE_FAILOVER: "true"
service:
# annotations may need to be set when want to scrapy metrics by prometheus but not install prometheus operator
annotations: {}
# serviceMonitor for prometheus operator
serviceMonitor:
# -- Enable or disable master serviceMonitor
enabled: false
# -- @param serviceMonitor.interval interval at which metrics should be scraped
interval: 15s
# -- @param serviceMonitor.path path of the metrics endpoint
path: /actuator/prometheus
# -- @param serviceMonitor.labels ServiceMonitor extra labels
labels: {}
# -- @param serviceMonitor.annotations ServiceMonitor annotations
annotations: {}

worker:
## PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down.
Expand Down Expand Up @@ -453,6 +468,21 @@ worker:
# - type: Percent
# value: 100
# periodSeconds: 15
service:
# annotations may need to be set when want to scrapy metrics by prometheus but not install prometheus operator
annotations: {}
# serviceMonitor for prometheus operator
serviceMonitor:
# -- Enable or disable worker serviceMonitor
enabled: false
# -- @param serviceMonitor.interval interval at which metrics should be scraped
interval: 15s
# -- @param serviceMonitor.path path of the metrics endpoint
path: /actuator/prometheus
# -- @param serviceMonitor.labels ServiceMonitor extra labels
labels: {}
# -- @param serviceMonitor.annotations ServiceMonitor annotations
annotations: {}


alert:
Expand Down Expand Up @@ -515,6 +545,22 @@ alert:
storage: "20Gi"
env:
JAVA_OPTS: "-Xms512m -Xmx512m -Xmn256m"
service:
# annotations may need to be set when want to scrapy metrics by prometheus but not install prometheus operator
annotations: {}
# serviceMonitor for prometheus operator
serviceMonitor:
# -- Enable or disable alert-server serviceMonitor
enabled: false
# -- @param serviceMonitor.interval interval at which metrics should be scraped
interval: 15s
# -- @param serviceMonitor.path path of the metrics endpoint
path: /actuator/prometheus
# -- @param serviceMonitor.labels ServiceMonitor extra labels
labels: {}
# -- @param serviceMonitor.annotations ServiceMonitor annotations
annotations: {}


api:
## Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.
Expand Down Expand Up @@ -592,6 +638,18 @@ api:
## annotations may need to be set when service.type is LoadBalancer
## service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:us-east-1:EXAMPLE_CERT
annotations: {}
# serviceMonitor for prometheus operator
serviceMonitor:
# -- Enable or disable api-server serviceMonitor
enabled: false
# -- @param serviceMonitor.interval interval at which metrics should be scraped
interval: 15s
# -- @param serviceMonitor.path path of the metrics endpoint
path: /dolphinscheduler/actuator/prometheus
# -- @param serviceMonitor.labels ServiceMonitor extra labels
labels: {}
# -- @param serviceMonitor.annotations ServiceMonitor annotations
annotations: {}
env:
JAVA_OPTS: "-Xms512m -Xmx512m -Xmn256m"

Expand Down