Skip to content

Commit

Permalink
feat: Add flag for prometheus-operator SMon
Browse files Browse the repository at this point in the history
Signed-off-by: Pat Riehecky <[email protected]>
  • Loading branch information
jcpunk committed May 31, 2023
1 parent 70e8b9b commit 648ec9f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
41 changes: 41 additions & 0 deletions charts/kubelet-csr-approver/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.metrics.enable .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "kubelet-csr-approver.fullname" . }}
namespace: {{ include "kubelet-csr-approver.namespace" . }}
labels:
{{- include "kubelet-csr-approver.labels" . | nindent 4 }}
{{- with .Values.metrics.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- with .Values.metrics.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Release.Name }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
{{- include "kubelet-csr-approver.selectorLabels" . | nindent 4 }}
endpoints:
- port: {{ .Values.metrics.port }}
path: /metrics
scheme: http
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/kubelet-csr-approver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ metrics:
serviceType: ClusterIP
port: 8080
annotations: {}
serviceMonitor:
enabled: false
additionalLabels: {}
interval: 1m
scrapeTimeout: 10s
metricRelabelings: []
relabelings: []

serviceAccount:
# Specifies whether a service account should be created
Expand Down

0 comments on commit 648ec9f

Please sign in to comment.