Skip to content

Commit a44d2c1

Browse files
committed
add serviceMonitor resource for helm
Signed-off-by: calvin chen <[email protected]>
1 parent 2ccf412 commit a44d2c1

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{{- if .Values.devicePlugin.serviceMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ include "hami-vgpu.device-plugin" . }}
6+
namespace: {{ include "hami-vgpu.namespace" . }}
7+
labels:
8+
release: prometheus
9+
spec:
10+
endpoints:
11+
- bearerTokenSecret:
12+
key: ""
13+
name: ""
14+
interval: 15s
15+
metricRelabelings:
16+
- action: replace
17+
sourceLabels:
18+
- podname
19+
targetLabel: exported_pod
20+
- action: replace
21+
sourceLabels:
22+
- podnamespace
23+
targetLabel: exported_namespace
24+
- targetLabel: cluster
25+
replacement: local-cluster
26+
- sourceLabels: [podname]
27+
regex: ^(.+)-[a-z0-9]{9,}-[a-z0-9]+$
28+
targetLabel: deployment_name
29+
replacement: $1
30+
action: replace
31+
- sourceLabels: [podnamespace, deployment_name]
32+
separator: /
33+
targetLabel: deployment
34+
action: replace
35+
path: /metrics
36+
port: monitorport
37+
relabelings:
38+
- action: replace
39+
sourceLabels:
40+
- __meta_kubernetes_endpoint_node_name
41+
targetLabel: node
42+
jobLabel: app
43+
namespaceSelector:
44+
matchNames:
45+
- {{ include "hami-vgpu.namespace" . }}
46+
selector:
47+
matchLabels:
48+
app.kubernetes.io/component: hami-device-plugin
49+
{{- end }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{- if .Values.scheduler.serviceMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ include "hami-vgpu.scheduler" . }}
6+
namespace: {{ include "hami-vgpu.namespace" . }}
7+
labels:
8+
release: prometheus
9+
spec:
10+
endpoints:
11+
- bearerTokenSecret:
12+
key: ""
13+
name: ""
14+
interval: 15s
15+
metricRelabelings:
16+
- action: replace
17+
sourceLabels:
18+
- podname
19+
targetLabel: exported_pod
20+
- action: replace
21+
sourceLabels:
22+
- podnamespace
23+
targetLabel: exported_namespace
24+
- action: replace
25+
sourceLabels:
26+
- nodeid
27+
targetLabel: node
28+
- targetLabel: cluster
29+
replacement: local-cluster
30+
path: /metrics
31+
port: monitor
32+
jobLabel: app
33+
namespaceSelector:
34+
matchNames:
35+
- {{ include "hami-vgpu.namespace" . }}
36+
selector:
37+
matchLabels:
38+
app.kubernetes.io/component: hami-scheduler
39+
{{- end }}

charts/hami/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ scheduler:
232232
monitorTargetPort: 9395
233233
labels: {}
234234
annotations: {}
235+
# enable serviceMonitor resource for hami scheduler
236+
serviceMonitor:
237+
enabled: false
235238

236239
devicePlugin:
237240
## @param image.registry devicePlugin image registry
@@ -296,6 +299,9 @@ devicePlugin:
296299
httpPort: 31992
297300
labels: {}
298301
annotations: {}
302+
# enable serviceMonitor resource for device plugin
303+
serviceMonitor:
304+
enabled: false
299305

300306
pluginPath: /var/lib/kubelet/device-plugins
301307
libPath: /usr/local/vgpu

0 commit comments

Comments
 (0)