feat(operator,metrics): add TLS support for metrics server#8997
Merged
gbartolini merged 5 commits intomainfrom Nov 6, 2025
Merged
feat(operator,metrics): add TLS support for metrics server#8997gbartolini merged 5 commits intomainfrom
gbartolini merged 5 commits intomainfrom
Conversation
Contributor
|
❗ By default, the pull request is configured to backport to all release branches.
|
Member
Author
|
/test |
Contributor
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/18916760779 |
fbb8742 to
9b89804
Compare
NiccoloFei
approved these changes
Nov 4, 2025
mnencia
approved these changes
Nov 5, 2025
gbartolini
approved these changes
Nov 6, 2025
Add optional TLS support for the operator metrics server (port 8080) to enhance security when exposing Prometheus metrics. The feature is opt-in and controlled entirely by the METRICS_CERT_DIR environment variable. When set, the operator will: - Enable TLS (SecureServing) for the metrics server - Look for certificates at the specified path - Use standard Kubernetes TLS secret naming (tls.crt/tls.key) When METRICS_CERT_DIR is not set (default), the metrics server continues to operate without TLS, ensuring no breaking changes to existing deployments. Usage: 1. Create a Kubernetes secret with TLS certificates (tls.crt and tls.key) 2. Mount the secret to the operator pod (e.g., /run/secrets/cnpg.io/metrics) 3. Set METRICS_CERT_DIR environment variable to the mount path 4. Update monitoring configuration (e.g., PodMonitor) to use HTTPS Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add optional TLS support for the operator metrics server (port 8080) to enhance security when exposing Prometheus metrics.
The feature is opt-in and controlled entirely by the
METRICS_CERT_DIRenvironment variable. When set, the operator will:When
METRICS_CERT_DIRis not set (default), the metrics server continues to operate without TLS, ensuring no breaking changes to existing deployments.Usage:
METRICS_CERT_DIRenvironment variable to the mount pathCloses #5070