Skip to content

Commit

Permalink
Add service monitor (#281)
Browse files Browse the repository at this point in the history
* Add service monitor

* Update Helm values schema

* Update CHANGELOG.md

* Remove the rest of the monitoring related GS annotations
  • Loading branch information
uvegla authored Jul 31, 2023
1 parent 8b29b0b commit 7041873
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add Service Monitor.

## [0.7.0] - 2023-07-04

### Added
Expand Down
8 changes: 2 additions & 6 deletions helm/config-controller/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ metadata:
namespace: {{ include "resource.default.namespace" . }}
labels:
{{- include "labels.common" . | nindent 4 }}
giantswarm.io/monitoring: "true"
annotations:
giantswarm.io/monitoring-path: "/metrics"
giantswarm.io/monitoring-port: "8000"
prometheus.io/scrape: "true"
spec:
ports:
- port: 8000
- name: http
port: 8000
selector:
{{- include "labels.selector" . | nindent 4 }}
18 changes: 18 additions & 0 deletions helm/config-controller/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "resource.default.name" . }}
namespace: {{ include "resource.default.namespace" . }}
labels:
{{- include "labels.common" . | nindent 4 }}
spec:
endpoints:
- interval: {{ .Values.serviceMonitor.interval }}
path: /metrics
port: http
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
selector:
matchLabels:
{{- include "labels.selector" . | nindent 6 }}
{{- end }}
31 changes: 31 additions & 0 deletions helm/config-controller/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@
"securityContext": {
"type": "object",
"properties": {
"allowPrivilegeEscalation": {
"type": "boolean"
},
"capabilities": {
"type": "object",
"properties": {
"drop": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"runAsNonRoot": {
"type": "boolean"
},
"seccompProfile": {
"type": "object",
"properties": {
Expand All @@ -106,6 +123,20 @@
}
}
},
"serviceMonitor": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"interval": {
"type": "string"
},
"scrapeTimeout": {
"type": "string"
}
}
},
"vault": {
"type": "object",
"properties": {
Expand Down
7 changes: 7 additions & 0 deletions helm/config-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault

serviceMonitor:
enabled: true
# -- (duration) Prometheus scrape interval.
interval: "60s"
# -- (duration) Prometheus scrape timeout.
scrapeTimeout: "45s"

0 comments on commit 7041873

Please sign in to comment.