Skip to content

Commit

Permalink
Merge pull request #50 from Chia-Network/servicemonitor
Browse files Browse the repository at this point in the history
Add optional ServiceMonitor to the generic chart
  • Loading branch information
Starttoaster authored Jun 12, 2024
2 parents 833bc08 + c87cee4 commit 0436107
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/generic/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: generic
description: A generic helm chart that handles a bunch of common application deploy cases
type: application
version: 1.10.0
version: 1.11.0
43 changes: 43 additions & 0 deletions charts/generic/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 "generic.fullname" . }}
labels:
{{- include "generic.labels" . | nindent 4 }}
{{- if .Values.serviceMonitor.additionalLabels }}
{{- toYaml .Values.serviceMonitor.additionalLabels | nindent 4 }}
{{- end }}
{{- if .Values.serviceMonitor.annotations }}
annotations: {{ toYaml .Values.serviceMonitor.annotations | nindent 4 }}
{{- end }}
spec:
endpoints:
- interval: 30s
port: {{ .Values.serviceMonitor.endpointPort }}
{{- if .Values.serviceMonitor.relabelings }}
relabelings: {{ toYaml .Values.serviceMonitor.relabelings | nindent 8 }}
{{- end }}
{{- if .Values.serviceMonitor.metricRelabelings }}
metricRelabelings: {{ toYaml .Values.serviceMonitor.metricRelabelings | nindent 8 }}
{{- end }}
{{- if .Values.serviceMonitor.namespaceSelector }}
namespaceSelector: {{ toYaml .Values.serviceMonitor.namespaceSelector | nindent 4 }}
{{- else }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
{{- if .Values.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.serviceMonitor.jobLabel | quote }}
{{- end }}
{{- if .Values.serviceMonitor.targetLabels }}
targetLabels:
{{- range .Values.serviceMonitor.targetLabels }}
- {{ . }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "generic.labels" . | nindent 6 }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/generic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,24 @@ networkPolicy:
# - protocol: TCP
# port: 8555

serviceMonitor:
enabled: false
# Changes the servicemonitor's spec.endpoints[0].port
# Can be a port number or name
endpointPort: metrics
## The label to use to retrieve the job name from.
## jobLabel: "app.kubernetes.io/name"
additionalLabels: {}
annotations: {}
namespaceSelector: {}
## Default: scrape .Release.Namespace or namespaceOverride only
## To scrape all, use the following:
## namespaceSelector:
## any: true
targetLabels: []
relabelings: []
metricRelabelings: []

# Creates a secret with the following values, and mounts as env into the main deployment container
secretEnvironment: {}
# MY_KEY: "My Value"
Expand Down

0 comments on commit 0436107

Please sign in to comment.