Skip to content

Commit a52d85d

Browse files
stone-zmikedoughertyJimBugwadia
authored
Enable builtin metrics and add default ServiceMonitor (#159)
* Create sync-from-upstream.yaml Signed-off-by: Zach Stone <zach@giantswarm.io> * Update sync-from-upstream.yaml Signed-off-by: Zach Stone <zach@giantswarm.io> * fix(charts): remove erroneous 'metadata' key from ClusterRole object (#119) Signed-off-by: Mike Dougherty <mike.dougherty@missionlane.com> Co-authored-by: Jim Bugwadia <jim@nirmata.com> Signed-off-by: Zach Stone <zach@giantswarm.io> * Enable metrics endpoint and add service monitor Signed-off-by: Zach Stone <zach@giantswarm.io> * Update generated install Signed-off-by: Zach Stone <zach@giantswarm.io> * Do not enable ServiceMonitor by default Signed-off-by: Zach Stone <zach@giantswarm.io> * Rerun codegen Signed-off-by: Zach Stone <zach@giantswarm.io> --------- Signed-off-by: Zach Stone <zach@giantswarm.io> Signed-off-by: Mike Dougherty <mike.dougherty@missionlane.com> Co-authored-by: Mike Dougherty <mikedougherty@users.noreply.github.com> Co-authored-by: Jim Bugwadia <jim@nirmata.com>
1 parent ca35f64 commit a52d85d

File tree

6 files changed

+71
-0
lines changed

6 files changed

+71
-0
lines changed

charts/reports-server/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ helm install reports-server --namespace reports-server --create-namespace report
4444
| securityContext | object | See [values.yaml](values.yaml) | Container security context |
4545
| livenessProbe | object | `{"failureThreshold":10,"httpGet":{"path":"/livez","port":"https","scheme":"HTTPS"},"initialDelaySeconds":20,"periodSeconds":10}` | Liveness probe |
4646
| readinessProbe | object | `{"failureThreshold":10,"httpGet":{"path":"/readyz","port":"https","scheme":"HTTPS"},"initialDelaySeconds":30,"periodSeconds":10}` | Readiness probe |
47+
| metrics.enabled | bool | `true` | Enable prometheus metrics |
48+
| metrics.serviceMonitor.enabled | bool | `false` | Enable service monitor for scraping prometheus metrics |
49+
| metrics.serviceMonitor.additionalLabels | object | `{}` | Service monitor additional labels |
50+
| metrics.serviceMonitor.interval | string | `""` | Service monitor scrape interval |
51+
| metrics.serviceMonitor.metricRelabelings | list | `[]` | Service monitor metric relabelings |
52+
| metrics.serviceMonitor.relabelings | list | `[]` | Service monitor relabelings |
53+
| metrics.serviceMonitor.scrapeTimeout | string | `""` | Service monitor scrape timeout |
4754
| resources.limits | string | `nil` | Container resource limits |
4855
| resources.requests | string | `nil` | Container resource requests |
4956
| autoscaling.enabled | bool | `false` | Enable autoscaling |

charts/reports-server/templates/deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ spec:
5151
{{- end }}
5252
- --cert-dir=/tmp
5353
- --secure-port=4443
54+
{{- if .Values.metrics.enabled }}
55+
- --authorization-always-allow-paths=/metrics
56+
{{- end }}
5457
{{- if .Values.config.db.secretName }}
5558
env:
5659
- name: DB_HOST
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled -}}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ include "reports-server.fullname" . }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "reports-server.labels" . | nindent 4 }}
9+
{{- with .Values.metrics.serviceMonitor.additionalLabels }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
selector:
14+
matchLabels:
15+
{{- include "reports-server.selectorLabels" . | nindent 6 }}
16+
endpoints:
17+
- port: https
18+
path: /metrics
19+
scheme: https
20+
tlsConfig:
21+
insecureSkipVerify: true
22+
{{- if .Values.metrics.serviceMonitor.interval}}
23+
interval: {{ .Values.metrics.serviceMonitor.interval }}
24+
{{- end }}
25+
{{- if .Values.metrics.serviceMonitor.scrapeTimeout}}
26+
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
27+
{{- end }}
28+
{{- with .Values.metrics.serviceMonitor.metricRelabelings }}
29+
metricRelabelings:
30+
{{- toYaml . | nindent 8 }}
31+
{{- end }}
32+
{{- with .Values.metrics.serviceMonitor.relabelings }}
33+
relabelings:
34+
{{- toYaml . | nindent 8 }}
35+
{{- end }}
36+
{{- end -}}

charts/reports-server/values.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,29 @@ readinessProbe:
9898
port: https
9999
scheme: HTTPS
100100

101+
metrics:
102+
# -- Enable prometheus metrics
103+
enabled: true
104+
105+
serviceMonitor:
106+
# -- Enable service monitor for scraping prometheus metrics
107+
enabled: false
108+
109+
# -- Service monitor additional labels
110+
additionalLabels: {}
111+
112+
# -- Service monitor scrape interval
113+
interval: ""
114+
115+
# -- Service monitor metric relabelings
116+
metricRelabelings: []
117+
118+
# -- Service monitor relabelings
119+
relabelings: []
120+
121+
# -- Service monitor scrape timeout
122+
scrapeTimeout: ""
123+
101124
# We usually recommend not to specify default resources and to leave this as a conscious
102125
# choice for the user. This also increases chances charts run on environments with little
103126
# resources, such as Minikube. If you do want to specify resources, uncomment the following

config/install-inmemory.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ spec:
172172
- --debug
173173
- --cert-dir=/tmp
174174
- --secure-port=4443
175+
- --authorization-always-allow-paths=/metrics
175176
securityContext:
176177
allowPrivilegeEscalation: false
177178
capabilities:

config/install.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ spec:
267267
- --dbsslcert=
268268
- --cert-dir=/tmp
269269
- --secure-port=4443
270+
- --authorization-always-allow-paths=/metrics
270271
securityContext:
271272
allowPrivilegeEscalation: false
272273
capabilities:

0 commit comments

Comments
 (0)