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 f88b780
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 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 (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") (.Values.controller.serviceMonitor.forceEnable)}}
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
8 changes: 7 additions & 1 deletion charts/aws-ebs-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ controller:
# will run (example: `:8080` which corresponds to port 8080 on local host).
# The default is empty string, which means metrics endpoint is disabled.
# ---
enableMetrics: false
enableMetrics: true
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 f88b780

Please sign in to comment.