Skip to content

Commit

Permalink
Merge pull request #58 from daloman/k8s/serviceMonitor
Browse files Browse the repository at this point in the history
Add Kubernetes serviceMonitor resource
  • Loading branch information
prppedro authored Apr 26, 2022
2 parents 85673b2 + b66a697 commit f91d882
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rocketchat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ Parameter | Description | Default
`license` | Contents of the Enterprise License file, if applicable | `""`
`prometheusScraping.enabled` | Turn on and off /metrics endpoint for Prometheus scraping | `false`
`prometheusScraping.port` | Port to use for the metrics for Prometheus to scrap on | `9458`
`serviceMonitor.enabled` | Create ServiceMonitor resource(s) for scraping metrics using PrometheusOperator (prometheusScraping should be enabled) | `false`
`serviceMonitor.interval` | The interval at which metrics should be scraped | `30s`
`serviceMonitor.port` | The port name at which container exposes Prometheus metrics | `metrics`
`livenessProbe.enabled` | Turn on and off liveness probe | `true`
`livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60`
`livenessProbe.periodSeconds` | How often to perform the probe | `15`
Expand Down
20 changes: 20 additions & 0 deletions rocketchat/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if and .Values.serviceMonitor.enabled .Values.prometheusScraping.enabled}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "rocketchat.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
helm.sh/chart: {{ include "rocketchat.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
endpoints:
- port: {{ .Values.serviceMonitor.port }}
interval: {{ .Values.serviceMonitor.interval }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
helm.sh/chart: {{ include "rocketchat.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
12 changes: 12 additions & 0 deletions rocketchat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ prometheusScraping:
enabled: false
port: 9458

serviceMonitor:
## serviceMonitor.enabled Create ServiceMonitor resource(s) for scraping metrics using PrometheusOperator
## prometheusScraping.enabled should be also enabled
##
enabled: false
## metrics.serviceMonitor.interval The interval at which metrics should be scraped
##
interval: 30s
## metrics.serviceMonitor.port The port name at which container exposes Prometheus metrics
##
port: metrics

## Liveness and readiness probe values
## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
##
Expand Down

0 comments on commit f91d882

Please sign in to comment.