Skip to content

Commit

Permalink
Add serviceMonitor.labels parameter
Browse files Browse the repository at this point in the history
Add serviceMonitor.forceEnable parameter

Signed-off-by: Eddie Torres <[email protected]>
  • Loading branch information
torredil committed Oct 7, 2022
1 parent 7016a78 commit 6f5db70
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 7 additions & 5 deletions charts/aws-ebs-csi-driver/templates/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: v1
kind: Service
metadata:
name: ebs-csi-controller
namespace: kube-system
namespace: {{ .Release.Namespace }}
labels:
app: ebs-csi-controller
spec:
Expand All @@ -16,22 +16,24 @@ spec:
targetPort: 3301
type: ClusterIP
---
{{- if (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") -}}
{{- if or .Values.controller.serviceMonitor.forceEnable (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: ebs-csi-controller
namespace: kube-system
namespace: {{ .Release.Namespace }}
labels:
app: ebs-csi-controller
release: prometheus
{{- if .Values.controller.serviceMonitor.labels }}
{{- toYaml .Values.controller.serviceMonitor.labels | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app: ebs-csi-controller
namespaceSelector:
matchNames:
- kube-system
- {{ .Release.Namespace }}
endpoints:
- targetPort: 3301
path: /metrics
Expand Down
6 changes: 6 additions & 0 deletions charts/aws-ebs-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ controller:
# The default is empty string, which means metrics endpoint is disabled.
# ---
enableMetrics: false
serviceMonitor:
# Enables the ServiceMonitor resource even if the prometheus-operator CRDs are not installed
forceEnable: false
# Additional labels for ServiceMonitor object
labels:
release: prometheus
# If set to true, AWS API call metrics will be exported to the following
# TCP endpoint: "0.0.0.0:3301"
# ---
Expand Down

0 comments on commit 6f5db70

Please sign in to comment.