Skip to content

Commit

Permalink
servicemonitor: crd judgement & changable label
Browse files Browse the repository at this point in the history
  • Loading branch information
djangoyi-yunify committed Nov 9, 2023
1 parent 977a73e commit 0024f17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions charts/redis-operator/templates/redis-servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" -}}
{{- if eq .Values.serviceMonitor true }}
---
apiVersion: monitoring.coreos.com/v1
Expand All @@ -9,6 +10,9 @@ metadata:
app.kubernetes.io/vendor: kubesphere
redis-operator: "true"
env: production
{{- if .Values.customLabels.serviceMonitor.labels }}
{{- toYaml .Values.customLabels.serviceMonitor.labels | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
Expand All @@ -30,6 +34,9 @@ metadata:
app.kubernetes.io/vendor: kubesphere
redis-operator: "true"
env: production
{{- if .Values.customLabels.serviceMonitor.labels }}
{{- toYaml .Values.customLabels.serviceMonitor.labels | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
Expand All @@ -51,6 +58,9 @@ metadata:
app.kubernetes.io/vendor: kubesphere
redis-operator: "true"
env: production
{{- if .Values.customLabels.serviceMonitor.labels }}
{{- toYaml .Values.customLabels.serviceMonitor.labels | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
Expand All @@ -62,3 +72,4 @@ spec:
path: /metrics
interval: 10s
{{- end }}
{{ end }}
4 changes: 4 additions & 0 deletions charts/redis-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ tolerations: []
affinity: {}
serviceMonitor: true
redisPasswordEncrypt: 0

customLabels:
serviceMonitor:
labels:

0 comments on commit 0024f17

Please sign in to comment.