Skip to content

Commit 9d06d7e

Browse files
author
Frederic Spiers
committed
Merge remote-tracking branch 'upstream/main'
2 parents a70aac0 + 47d3947 commit 9d06d7e

File tree

13 files changed

+493
-43
lines changed

13 files changed

+493
-43
lines changed

charts/postgres/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,30 @@ extraObjects:
288288
289289
All objects in `extraObjects` will be rendered and deployed with the release. You can use any valid Kubernetes manifest, and reference Helm values or built-in objects as needed (just remember to quote template expressions).
290290

291+
### Metrics Configuration
292+
293+
| Parameter | Description | Default |
294+
| ------------------------------------------ | ------------------------------------------------------------------------------- | --------------------------------------- |
295+
| `metrics.enabled` | Start a sidecar prometheus exporter to expose PostgreSQL metrics | `false` |
296+
| `metrics.image.registry` | PostgreSQL exporter image registry | `quay.io` |
297+
| `metrics.image.repository` | PostgreSQL exporter image repository | `prometheuscommunity/postgres-exporter` |
298+
| `metrics.image.tag` | PostgreSQL exporter image tag | `v0.18.1` |
299+
| `metrics.image.pullPolicy` | PostgreSQL exporter image pull policy | `Always` |
300+
| `metrics.resources` | Resource limits and requests for metrics container | `{}` |
301+
| `metrics.service.annotations` | Additional custom annotations for Metrics service | `{}` |
302+
| `metrics.service.labels` | Additional custom labels for Metrics service | `{}` |
303+
| `metrics.service.port` | Metrics service port | `9187` |
304+
| `metrics.serviceMonitor.enabled` | Create ServiceMonitor resource(s) for scraping metrics using PrometheusOperator | `false` |
305+
| `metrics.serviceMonitor.namespace` | The namespace in which the ServiceMonitor will be created | `""` |
306+
| `metrics.serviceMonitor.interval` | The interval at which metrics should be scraped | `30s` |
307+
| `metrics.serviceMonitor.scrapeTimeout` | The timeout after which the scrape is ended | `10s` |
308+
| `metrics.serviceMonitor.selector` | Additional labels for ServiceMonitor resource | `{}` |
309+
| `metrics.serviceMonitor.annotations` | ServiceMonitor annotations | `{}` |
310+
| `metrics.serviceMonitor.honorLabels` | honorLabels chooses the metric's labels on collisions with target labels | `false` |
311+
| `metrics.serviceMonitor.relabelings` | ServiceMonitor relabel configs to apply to samples before scraping | `[]` |
312+
| `metrics.serviceMonitor.metricRelabelings` | ServiceMonitor metricRelabelings configs to apply to samples before ingestion | `[]` |
313+
| `metrics.serviceMonitor.namespaceSelector` | ServiceMonitor namespace selector | `{}` |
314+
291315
## Examples
292316

293317
### Basic Deployment
@@ -439,6 +463,33 @@ data:
439463
# Add your custom configuration here
440464
```
441465

466+
### Monitoring with Prometheus
467+
468+
Enable metrics collection with Prometheus:
469+
470+
```yaml
471+
# values-monitoring.yaml
472+
metrics:
473+
enabled: true
474+
serviceMonitor:
475+
enabled: true
476+
```
477+
478+
Deploy with monitoring enabled:
479+
480+
```bash
481+
helm install my-postgres ./charts/postgres -f values-monitoring.yaml
482+
```
483+
484+
The PostgreSQL exporter will expose metrics on port 9187, and if you have Prometheus Operator installed, the ServiceMonitor will automatically configure Prometheus to scrape the metrics.
485+
486+
You can access metrics directly via port-forward:
487+
488+
```bash
489+
kubectl port-forward service/my-postgres-metrics 9187:9187
490+
curl http://localhost:9187/metrics
491+
```
492+
442493
## Access PostgreSQL
443494

444495
### Via kubectl port-forward
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- if .Values.metrics.enabled }}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ include "postgres.fullname" . }}-metrics
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "postgres.labels" . | nindent 4 }}
9+
app.kubernetes.io/component: metrics
10+
{{- with .Values.metrics.service.labels }}
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
{{- with .Values.metrics.service.annotations }}
14+
annotations:
15+
{{- toYaml . | nindent 4 }}
16+
{{- end }}
17+
spec:
18+
type: ClusterIP
19+
ports:
20+
- name: metrics
21+
port: {{ .Values.metrics.service.port }}
22+
protocol: TCP
23+
targetPort: metrics
24+
selector:
25+
{{- include "postgres.selectorLabels" . | nindent 4 }}
26+
{{- end }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ include "postgres.fullname" . }}-metrics
6+
{{- if .Values.metrics.serviceMonitor.namespace }}
7+
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
8+
{{- else }}
9+
namespace: {{ .Release.Namespace }}
10+
{{- end }}
11+
labels:
12+
{{- include "postgres.labels" . | nindent 4 }}
13+
app.kubernetes.io/component: metrics
14+
{{- with .Values.metrics.serviceMonitor.selector }}
15+
{{- toYaml . | nindent 4 }}
16+
{{- end }}
17+
{{- with .Values.metrics.serviceMonitor.annotations }}
18+
annotations:
19+
{{- toYaml . | nindent 4 }}
20+
{{- end }}
21+
spec:
22+
jobLabel: {{ include "postgres.fullname" . }}
23+
selector:
24+
matchLabels:
25+
{{- include "postgres.selectorLabels" . | nindent 6 }}
26+
app.kubernetes.io/component: metrics
27+
endpoints:
28+
- port: metrics
29+
{{- with .Values.metrics.serviceMonitor.interval }}
30+
interval: {{ . }}
31+
{{- end }}
32+
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
33+
scrapeTimeout: {{ . }}
34+
{{- end }}
35+
path: /metrics
36+
{{- with .Values.metrics.serviceMonitor.honorLabels }}
37+
honorLabels: {{ . }}
38+
{{- end }}
39+
{{- with .Values.metrics.serviceMonitor.relabelings }}
40+
relabelings:
41+
{{- toYaml . | nindent 8 }}
42+
{{- end }}
43+
{{- with .Values.metrics.serviceMonitor.metricRelabelings }}
44+
metricRelabelings:
45+
{{- toYaml . | nindent 8 }}
46+
{{- end }}
47+
{{- with .Values.metrics.serviceMonitor.namespaceSelector }}
48+
namespaceSelector:
49+
{{- toYaml . | nindent 4 }}
50+
{{- end }}
51+
{{- end }}

charts/postgres/templates/statefulset.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,49 @@ spec:
192192
- name: custom-init-scripts
193193
mountPath: {{ .Values.initdb.directory }}
194194
{{- end }}
195+
{{- if .Values.metrics.enabled }}
196+
- name: metrics
197+
image: "{{ .Values.metrics.image.registry }}/{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}"
198+
imagePullPolicy: {{ .Values.metrics.image.pullPolicy }}
199+
securityContext:
200+
allowPrivilegeEscalation: false
201+
capabilities:
202+
drop:
203+
- ALL
204+
privileged: false
205+
readOnlyRootFilesystem: true
206+
runAsNonRoot: true
207+
runAsUser: 65534
208+
runAsGroup: 65534
209+
env:
210+
- name: DATA_SOURCE_NAME
211+
value: "postgresql://{{ include "postgres.username" . }}:$(POSTGRES_PASSWORD)@localhost:{{ .Values.service.targetPort }}/{{ include "postgres.database" . }}?sslmode=disable"
212+
- name: POSTGRES_PASSWORD
213+
valueFrom:
214+
secretKeyRef:
215+
name: {{ include "postgres.secretName" . }}
216+
key: {{ .Values.auth.secretKeys.passwordKey }}
217+
ports:
218+
- name: metrics
219+
containerPort: 9187
220+
protocol: TCP
221+
startupProbe:
222+
httpGet:
223+
path: /
224+
port: metrics
225+
readinessProbe:
226+
httpGet:
227+
path: /
228+
port: metrics
229+
livenessProbe:
230+
httpGet:
231+
path: /
232+
port: metrics
233+
{{- with .Values.metrics.resources }}
234+
resources:
235+
{{- toYaml . | nindent 12 }}
236+
{{- end }}
237+
{{- end }}
195238
volumes:
196239
{{- if not .Values.persistence.enabled }}
197240
- name: data

charts/postgres/values.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,49 @@ initContainers: []
287287

288288
## @param extraObjects Array of extra objects to deploy with the release
289289
extraObjects: []
290+
291+
## @section Metrics configuration
292+
metrics:
293+
## @param metrics.enabled Start a sidecar prometheus exporter to expose PostgreSQL metrics
294+
enabled: false
295+
image:
296+
## @param metrics.image.registry PostgreSQL exporter image registry
297+
registry: quay.io
298+
## @param metrics.image.repository PostgreSQL exporter image repository
299+
repository: prometheuscommunity/postgres-exporter
300+
## @param metrics.image.tag PostgreSQL exporter image tag
301+
tag: "v0.18.1@sha256:fb96c4413985d4b23ab02b19022b3d70a86c8e0a62f41ab15ebb6f4673781a5d"
302+
## @param metrics.image.pullPolicy PostgreSQL exporter image pull policy
303+
pullPolicy: Always
304+
## @param metrics.resources Resource limits and requests for metrics container
305+
resources: {}
306+
## Metrics service configuration
307+
service:
308+
## @param metrics.service.annotations Additional custom annotations for Metrics service
309+
annotations: {}
310+
## @param metrics.service.labels Additional custom labels for Metrics service
311+
labels: {}
312+
## @param metrics.service.port Metrics service port
313+
port: 9187
314+
## Prometheus Operator ServiceMonitor configuration
315+
serviceMonitor:
316+
## @param metrics.serviceMonitor.enabled Create ServiceMonitor resource(s) for scraping metrics using PrometheusOperator
317+
enabled: false
318+
## @param metrics.serviceMonitor.namespace The namespace in which the ServiceMonitor will be created
319+
namespace: ""
320+
## @param metrics.serviceMonitor.interval The interval at which metrics should be scraped
321+
interval: 30s
322+
## @param metrics.serviceMonitor.scrapeTimeout The timeout after which the scrape is ended
323+
scrapeTimeout: 10s
324+
## @param metrics.serviceMonitor.selector Additional labels for ServiceMonitor resource
325+
selector: {}
326+
## @param metrics.serviceMonitor.annotations ServiceMonitor annotations
327+
annotations: {}
328+
## @param metrics.serviceMonitor.honorLabels honorLabels chooses the metric's labels on collisions with target labels
329+
honorLabels: false
330+
## @param metrics.serviceMonitor.relabelings ServiceMonitor relabel configs to apply to samples before scraping
331+
relabelings: []
332+
## @param metrics.serviceMonitor.metricRelabelings ServiceMonitor metricRelabelings configs to apply to samples before ingestion
333+
metricRelabelings: []
334+
## @param metrics.serviceMonitor.namespaceSelector ServiceMonitor namespace selector
335+
namespaceSelector: {}

charts/rabbitmq/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## 0.3.2 (2025-10-09)
44

5-
* [mongodb] feat: add metrics exporter ([#243](https://github.com/CloudPirates-io/helm-charts/pull/243))
5+
* [rabbitmq]: add option to handle definitions via chart ([#286](https://github.com/CloudPirates-io/helm-charts/pull/286))

charts/rabbitmq/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: rabbitmq
33
description: A messaging broker that implements the Advanced Message Queuing Protocol (AMQP)
44
type: application
5-
version: 0.3.2
5+
version: 0.3.3
66
appVersion: "4.1.4"
77
keywords:
88
- rabbitmq

0 commit comments

Comments
 (0)