Skip to content
Open
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
15 changes: 14 additions & 1 deletion charts/hami/templates/_commons.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,17 @@ imagePullSecrets:
- name: {{ . }}
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}

{{/*
Renders a value that contains template.
Usage:
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "common.tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
24 changes: 24 additions & 0 deletions charts/hami/templates/device-plugin/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.devicePlugin.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "hami-vgpu.device-plugin" . }}
namespace: {{ include "hami-vgpu.namespace" . }}
labels:
{{- include "hami-vgpu.labels" . | nindent 4 }}
{{- if .Values.devicePlugin.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.devicePlugin.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
spec:
endpoints:
- interval: {{ .Values.devicePlugin.serviceMonitor.interval }}
path: /metrics
port: monitorport
jobLabel: app
namespaceSelector:
matchNames:
- {{ include "hami-vgpu.namespace" . }}
selector:
matchLabels:
app.kubernetes.io/component: hami-device-plugin
{{- end }}
24 changes: 24 additions & 0 deletions charts/hami/templates/scheduler/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.scheduler.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "hami-vgpu.scheduler" . }}
namespace: {{ include "hami-vgpu.namespace" . }}
labels:
{{- include "hami-vgpu.labels" . | nindent 4 }}
{{- if .Values.scheduler.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.scheduler.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
spec:
endpoints:
- interval: {{ .Values.scheduler.serviceMonitor.interval }}
path: /metrics
port: monitor
jobLabel: app
namespaceSelector:
matchNames:
- {{ include "hami-vgpu.namespace" . }}
selector:
matchLabels:
app.kubernetes.io/component: hami-scheduler
{{- end }}
12 changes: 12 additions & 0 deletions charts/hami/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ scheduler:
monitorTargetPort: 9395
labels: {}
annotations: {}
# enable serviceMonitor resource for hami scheduler
serviceMonitor:
enabled: false
interval: "15s"
labels:
release: prometheus

devicePlugin:
## @param image.registry devicePlugin image registry
Expand Down Expand Up @@ -296,6 +302,12 @@ devicePlugin:
httpPort: 31992
labels: {}
annotations: {}
# enable serviceMonitor resource for device plugin
serviceMonitor:
enabled: false
interval: "15s"
labels:
release: prometheus

pluginPath: /var/lib/kubelet/device-plugins
libPath: /usr/local/vgpu
Expand Down
Loading