diff --git a/charts/aws-ebs-csi-driver/templates/metrics.yaml b/charts/aws-ebs-csi-driver/templates/metrics.yaml index db4ac0d399..1fbba24c68 100644 --- a/charts/aws-ebs-csi-driver/templates/metrics.yaml +++ b/charts/aws-ebs-csi-driver/templates/metrics.yaml @@ -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: @@ -21,17 +21,19 @@ 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 diff --git a/charts/aws-ebs-csi-driver/values.yaml b/charts/aws-ebs-csi-driver/values.yaml index 047f3fc841..7d1431b77c 100644 --- a/charts/aws-ebs-csi-driver/values.yaml +++ b/charts/aws-ebs-csi-driver/values.yaml @@ -140,6 +140,10 @@ controller: # The default is empty string, which means metrics endpoint is disabled. # --- enableMetrics: false + serviceMonitor: + # 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" # ---