-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(metrics): building blocks for postgres exporter (#53)
## Description This PR enhances the package by introducing a metrics endpoint to the PostgreSQL cluster pods. The implementation involves adding a sidecar to the pods, which exposes a port for Prometheus to scrape using a configured PodMonitor. The changes avoid using the package CR to expose the metrics endpoint due to its complexity, particularly the need to exempt from uds/skip-mutate: "true" and to configure the PeerAuthentication CR to carve out a permissive mTLS port for the PodMonitor. Monitoring can be enabled, but defaults to false. ## Related Issue Relates to #51 ## Type of change - [ ] New feature (non-breaking change which adds functionality) ## Checklist before merging - [ ] Test, docs, adr added or updated as needed - [ ] [Contributor Guide Steps](https://github.com/defenseunicorns/uds-package-postgres-operator/blob/main/CONTRIBUTING.md#developer-workflow) followed --------- Co-authored-by: Wayne Starr <Racer159@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PodMonitor | ||
metadata: | ||
name: postgres-exporter | ||
namespace: postgres | ||
spec: | ||
scrapeClass: istio-certs | ||
namespaceSelector: | ||
matchNames: | ||
- postgres | ||
podMetricsEndpoints: | ||
- port: exporter | ||
scheme: https | ||
enableHttp2: false | ||
selector: | ||
matchLabels: | ||
application: spilo | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
metrics: | ||
image: "registry1.dso.mil/ironbank/opensource/prometheus/postgres-exporter:v0.15.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
metrics: | ||
image: "quay.io/prometheuscommunity/postgres-exporter:v0.15.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters