OCPBUGS-98918: Use service-ca certificates for network-check-source metrics - #3097
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@tpantelis: This pull request references Jira Issue OCPBUGS-98918, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Summary by CodeRabbit
WalkthroughThe network diagnostics metrics endpoint now serves HTTPS with an OpenShift-generated certificate. The deployment mounts the certificate Secret, the metrics server loads the certificate files, and the ServiceMonitor validates the service CA and DNS name. ChangesSecure metrics serving
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (6 errors)
✅ Passed checks (18 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/jira refresh |
|
@tpantelis: This pull request references Jira Issue OCPBUGS-98918, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (core-networking-bot@redhat.com), skipping review request. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/cmd/checkendpoints/cmd.go`:
- Around line 78-80: Add or update tests covering the cross-layer TLS contract:
in pkg/cmd/checkendpoints/cmd.go lines 78-80, test the metrics server options
and certificate rotation path; in
bindata/network-diagnostics/network-check-source.yaml lines 74-77, 105-108, 118,
and 146-147, add bindata tests verifying the certificate directory, filenames,
Secret name, mount path, HTTPS scheme, CA path, and serverName. If existing
tests already cover all requirements, document that exception instead.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 64682a83-429d-44ee-8f62-f5d8f8ea619c
📒 Files selected for processing (2)
bindata/network-diagnostics/network-check-source.yamlpkg/cmd/checkendpoints/cmd.go
Replace insecureSkipVerify with proper certificate validation using OpenShift's service-ca operator. This fixes a security vulnerability where Prometheus scrapes metrics without validating the server's TLS certificate, making it vulnerable to man-in-the-middle attacks. Previously, the metrics endpoint used self-signed certificates which Prometheus could not validate, requiring insecureSkipVerify: true. Now we use service-ca to generate properly signed certificates that Prometheus can validate using the cluster's CA bundle. Changes: - Configure controller-runtime metrics server to use service-ca certs instead of self-signed certificates (CertDir, CertName, KeyName) - Add service.beta.openshift.io/serving-cert-secret-name annotation to trigger automatic certificate generation and rotation - Mount certificate secret in deployment at /etc/pki/tls/metrics-certs - Update ServiceMonitor to validate certificates using caFile and serverName instead of insecureSkipVerify: true Certificate rotation is handled automatically by controller-runtime's built-in certwatcher, which hot-reloads certificates when service-ca rotates them without requiring pod restart. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
f30f2de to
25dc7f4
Compare
|
@coderabbitai approve |
✅ Action performedComments resolved and changes approved. |
|
sure |
|
Scheduling required tests: Scheduling tests matching the |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danwinship, tpantelis The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/verified by CI |
|
@weliang1: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retest |
|
/override ci/prow/e2e-aws-ovn-fdp-qe ci/prow/e2e-metal-ipi-ovn-ipv6-ipsec ci/prow/hypershift-e2e-aks |
|
@danwinship: Overrode contexts on behalf of danwinship: ci/prow/e2e-aws-ovn-fdp-qe, ci/prow/e2e-metal-ipi-ovn-ipv6-ipsec, ci/prow/hypershift-e2e-aks DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
/override ci/prow/e2e-metal-ipi-ovn-ipv6 |
|
@danwinship: Overrode contexts on behalf of danwinship: ci/prow/e2e-metal-ipi-ovn-ipv6 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@tpantelis: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@tpantelis: Jira Issue Verification Checks: Jira Issue OCPBUGS-98918 Jira Issue OCPBUGS-98918 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Replace
insecureSkipVerifywith proper certificate validation using OpenShift's service-ca operator. This fixes a security vulnerability where Prometheus scrapes metrics without validating the server's TLS certificate, making it vulnerable to man-in-the-middle attacks.Previously, the metrics endpoint used self-signed certificates which Prometheus could not validate, requiring insecureSkipVerify: true. Now we use service-ca to generate properly signed certificates that Prometheus can validate using the cluster's CA bundle.
Changes:
CertDir,CertName,KeyName)service.beta.openshift.io/serving-cert-secret-nameannotation to trigger automatic certificate generation and rotationServiceMonitorto validate certificates usingcaFileandserverNameinstead ofinsecureSkipVerify: trueCertificate rotation is handled automatically by controller-runtime's built-in
certwatcher, which hot-reloads certificates when service-ca rotates them without requiring pod restart.