Skip to content

Add ServiceMonitor object to allow service detection with Prometheus Operator #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions helm/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{- if .Values.parseable.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "parseable.fullname" . }}
namespace: {{ default .Release.Namespace .Values.parseable.metrics.serviceMonitor.namespace | quote }}
labels: {{- include "parseable.selectorLabels" . | nindent 4 }}
{{- if .Values.parseable.metrics.serviceMonitor.additionalLabels }}
{{- include (dict "value" .Values.parseable.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: parseable-metrics
{{- if .Values.parseable.metrics.serviceMonitor.interval }}
interval: {{ .Values.parseable.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.parseable.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.parseable.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.parseable.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.parseable.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.parseable.metrics.serviceMonitor.relabellings }}
relabelings: {{- toYaml .Values.parseable.metrics.serviceMonitor.relabellings | nindent 6 }}
{{- end }}
{{- if .Values.parseable.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.parseable.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.parseable.metrics.serviceMonitor.podTargetLabels }}
podTargetLabels: {{- toYaml .Values.parseable.metrics.serviceMonitor.podTargetLabels | nindent 4 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels: {{- include "parseable.selectorLabels" . | nindent 6 }}
{{- end }}
44 changes: 31 additions & 13 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,33 @@ parseable:
## Set to true if you want to deploy Parseable in local mode (store logs
## on local mount point instead of S3 bucket)
local: false
# env:
# RUST_LOG: error
# ## Enable to create and configure logstreams
# logstream:
# - name: "vectordemo"
# retention:
# action: "delete"
# duration: "30d"
# - name: "fluentbitdemo"
# retention:
# action: "delete"
# duration: "30d"
## Use this section to create ServiceMonitor object for
## this Parseable deployment. Read more on ServiceMonitor
## here: https://prometheus-operator.dev/docs/operator/design/#servicemonitor
metrics:
serviceMonitor:
enabled: true
namespace: ""
interval: 30s
scrapeTimeout: ""
relabellings: []
metricRelabelings: []
honorLabels: false
additionalLabels: {}
podTargetLabels: []
## Add environment variables to the Parseable Deployment Pod
env:
# RUST_LOG: error
## Enable to create and configure log retention for logstreams
logstream:
# - name: "vectordemo"
# retention:
# action: "delete"
# duration: "30d"
# - name: "fluentbitdemo"
# retention:
# action: "delete"
# duration: "30d"
## enable/disable persistence using PVC for the Data and Staging directories
## Note that Data directory is needed only for local mode
persistence:
Expand Down Expand Up @@ -79,7 +94,10 @@ parseable:
memory: 1Gi
securityContext:
allowPrivilegeEscalation: false
podAnnotations: {}
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "80"
prometheus.io/path: "/api/v1/metrics"
podSecurityContext:
runAsUser: 1000
runAsGroup: 1000
Expand Down