diff --git a/deploy/charts/rawfile-csi/templates/01-node-plugin.yaml b/deploy/charts/rawfile-csi/templates/01-node-plugin.yaml index f6ec61f..2356707 100644 --- a/deploy/charts/rawfile-csi/templates/01-node-plugin.yaml +++ b/deploy/charts/rawfile-csi/templates/01-node-plugin.yaml @@ -1,3 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "rawfile-csi.fullname" . }}-node + labels: + {{- include "rawfile-csi.labels" . | nindent 4 }} + component: node +spec: + type: ClusterIP + ports: + - name: metrics + port: 9100 + targetPort: metrics + protocol: TCP + selector: + {{- include "rawfile-csi.selectorLabels" . | nindent 4 }} + component: node +--- apiVersion: apps/v1 kind: DaemonSet metadata: @@ -49,6 +67,9 @@ spec: fieldRef: apiVersion: v1 fieldPath: spec.nodeName + ports: + - name: metrics + containerPort: 9100 volumeMounts: - name: socket-dir mountPath: /csi diff --git a/deploy/charts/rawfile-csi/templates/01-servicemonitor.yaml b/deploy/charts/rawfile-csi/templates/01-servicemonitor.yaml new file mode 100644 index 0000000..ae4c58d --- /dev/null +++ b/deploy/charts/rawfile-csi/templates/01-servicemonitor.yaml @@ -0,0 +1,21 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "rawfile-csi.fullname" . }}-node + labels: + {{- include "rawfile-csi.labels" . | nindent 4 }} +spec: + endpoints: + - port: metrics + path: /metrics + interval: {{ .Values.serviceMonitor.interval }} + jobLabel: "helm.sh/chart" + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + {{- include "rawfile-csi.selectorLabels" . | nindent 6 }} + component: node +{{- end }} diff --git a/deploy/charts/rawfile-csi/values.yaml b/deploy/charts/rawfile-csi/values.yaml index 2380ecf..7747d26 100644 --- a/deploy/charts/rawfile-csi/values.yaml +++ b/deploy/charts/rawfile-csi/values.yaml @@ -20,3 +20,6 @@ node: enabled: false imagePullSecrets: [] +serviceMonitor: + enabled: true + interval: 15s