diff --git a/CHANGELOG.md b/CHANGELOG.md index 95080427..229fae29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/helm/config-controller/templates/service.yaml b/helm/config-controller/templates/service.yaml index 5f327118..a434993d 100644 --- a/helm/config-controller/templates/service.yaml +++ b/helm/config-controller/templates/service.yaml @@ -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 }} diff --git a/helm/config-controller/templates/servicemonitor.yaml b/helm/config-controller/templates/servicemonitor.yaml new file mode 100644 index 00000000..d91f44eb --- /dev/null +++ b/helm/config-controller/templates/servicemonitor.yaml @@ -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 }} diff --git a/helm/config-controller/values.schema.json b/helm/config-controller/values.schema.json index f6db9674..9621cb2b 100644 --- a/helm/config-controller/values.schema.json +++ b/helm/config-controller/values.schema.json @@ -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": { @@ -106,6 +123,20 @@ } } }, + "serviceMonitor": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "interval": { + "type": "string" + }, + "scrapeTimeout": { + "type": "string" + } + } + }, "vault": { "type": "object", "properties": { diff --git a/helm/config-controller/values.yaml b/helm/config-controller/values.yaml index e7085dbe..56419b14 100644 --- a/helm/config-controller/values.yaml +++ b/helm/config-controller/values.yaml @@ -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"