Skip to content

Commit

Permalink
feat(spectre): add service monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
paulohpigatto committed Jan 20, 2025
1 parent 2424a7e commit 3006dfe
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/spectre/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.3.2
version: 0.3.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
13 changes: 12 additions & 1 deletion charts/spectre/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# spectre

![Version: 0.3.2](https://img.shields.io/badge/Version-0.3.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.42.2](https://img.shields.io/badge/AppVersion-0.42.2-informational?style=flat-square)
![Version: 0.3.3](https://img.shields.io/badge/Version-0.3.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.42.2](https://img.shields.io/badge/AppVersion-0.42.2-informational?style=flat-square)

A Helm chart for deploying Chronicle Spectre Relay on Kubernetes

Expand Down Expand Up @@ -72,6 +72,17 @@ A Helm chart for deploying Chronicle Spectre Relay on Kubernetes
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `""` | |
| serviceMonitor.annotations | object | `{}` | Additional ServiceMonitor annotations |
| serviceMonitor.enabled | bool | `false` | If true, a ServiceMonitor CRD is created for a prometheus operator https://github.com/coreos/prometheus-operator |
| serviceMonitor.interval | string | `"60s"` | ServiceMonitor scrape interval |
| serviceMonitor.labels | object | `{}` | Additional ServiceMonitor labels |
| serviceMonitor.namespace | string | `nil` | Alternative namespace for ServiceMonitor |
| serviceMonitor.path | string | `"/metrics"` | Path to scrape |
| serviceMonitor.port | string | `"metrics"` | port to scrape |
| serviceMonitor.relabelings | list | `[]` | ServiceMonitor relabelings |
| serviceMonitor.scheme | string | `"http"` | ServiceMonitor scheme |
| serviceMonitor.scrapeTimeout | string | `"60s"` | ServiceMonitor scrape timeout |
| serviceMonitor.tlsConfig | object | `{}` | ServiceMonitor TLS configuration |
| tolerations | list | `[]` | |
| tor-proxy.enabled | bool | `true` | values for tor-proxy, installs [tor-controller](/crds/tor-controller.yaml) and creates an [onionService CRD](/templates/onion-service.yaml) |
| txType | string | `nil` | can be one of `legacy`or `eip1559` |
Expand Down
19 changes: 19 additions & 0 deletions charts/spectre/templates/service-metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "spectre.fullname" . }}-metrics
annotations:
{{- with .Values.service.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "spectre.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- name: metrics
port: 9090
protocol: TCP
targetPort: 9090
selector:
{{- include "spectre.selectorLabels" . | nindent 4 }}
43 changes: 43 additions & 0 deletions charts/spectre/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "spectre.fullname" . }}
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
labels:
{{- include "spectre.labels" . | nindent 4 }}
{{- if .Values.serviceMonitor.labels }}
{{- toYaml .Values.serviceMonitor.labels | nindent 4 }}
{{- end }}
{{- if .Values.serviceMonitor.annotations }}
annotations:
{{ toYaml .Values.serviceMonitor.annotations | nindent 4 }}
{{- end }}
spec:
endpoints:
- interval: {{ .Values.serviceMonitor.interval }}
{{- if .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
{{- end }}
honorLabels: true
port: {{ .Values.serviceMonitor.port }}
path: {{ .Values.serviceMonitor.path }}
scheme: {{ .Values.serviceMonitor.scheme }}
{{- if .Values.serviceMonitor.tlsConfig }}
tlsConfig:
{{- toYaml .Values.serviceMonitor.tlsConfig | nindent 6 }}
{{- end }}
{{- if .Values.serviceMonitor.relabelings }}
relabelings:
{{- toYaml .Values.serviceMonitor.relabelings | nindent 4 }}
{{- end }}
jobLabel: "{{ .Release.Name }}"
selector:
matchLabels:
{{- include "spectre.selectorLabels" . | nindent 8 }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
25 changes: 25 additions & 0 deletions charts/spectre/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,31 @@ tor-proxy:
# -- values for tor-proxy, installs [tor-controller](/crds/tor-controller.yaml) and creates an [onionService CRD](/templates/onion-service.yaml)
enabled: true

serviceMonitor:
# -- If true, a ServiceMonitor CRD is created for a prometheus operator
# https://github.com/coreos/prometheus-operator
enabled: false
# -- port to scrape
port: metrics
# -- Path to scrape
path: /metrics
# -- Alternative namespace for ServiceMonitor
namespace: null
# -- Additional ServiceMonitor labels
labels: {}
# -- Additional ServiceMonitor annotations
annotations: {}
# -- ServiceMonitor scrape interval
interval: 60s
# -- ServiceMonitor scheme
scheme: http
# -- ServiceMonitor TLS configuration
tlsConfig: {}
# -- ServiceMonitor scrape timeout
scrapeTimeout: 60s
# -- ServiceMonitor relabelings
relabelings: []

# -- Extra K8s manifests to deploy
extraObjects: []
# - apiVersion: "kubernetes-client.io/v1"
Expand Down

0 comments on commit 3006dfe

Please sign in to comment.