LOG-8978: Enhance log-file-metrics-exporter to only allow scraping of metrics from a secure endpoint#3247
LOG-8978: Enhance log-file-metrics-exporter to only allow scraping of metrics from a secure endpoint#3247Clee2691 wants to merge 1 commit intoopenshift:masterfrom
Conversation
… metrics from a secure endpoint
|
@Clee2691: This pull request references LOG-8978 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.8.0" version, but no target version was set. 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. |
|
/hold |
Review Summary by QodoSecure log-file-metrics-exporter metrics endpoint with bearer token authentication
WalkthroughsDescription• Add RBAC for metrics endpoint authentication via TokenReview and SubjectAccessReview • Enable secure metrics flag in log-file-metric-exporter binary • Configure ServiceMonitor to include Prometheus bearer token authentication • Update e2e tests to validate secure metrics endpoint with bearer token Diagramflowchart LR
RBAC["RBAC Configuration<br/>TokenReview & SubjectAccessReview"]
Flag["Secure Metrics Flag<br/>-secureMetrics"]
ServiceMonitor["ServiceMonitor<br/>Bearer Token"]
E2E["E2E Tests<br/>Token Validation"]
RBAC --> Flag
Flag --> ServiceMonitor
ServiceMonitor --> E2E
File Changes1. internal/auth/rbac.go
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Clee2691 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Code Review by Qodo
|
|
@Clee2691: This pull request references LOG-8978 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.8.0" version, but no target version was set. 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. |
|
@Clee2691: The following test failed, say
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. |
|
/lgtm |
| // It creates: | ||
| // - A ClusterRole allowing tokenreviews and subjectaccessreviews (for server-side token validation) | ||
| // - A ClusterRoleBinding binding the above role to the service account | ||
| func ReconcileMetricsRBAC(k8sClient client.Client, name, saNamespace, saName string) error { |
There was a problem hiding this comment.
Do we need to create these cluster roles or can we defer to OLM to create them from the CSV since the operator will require the same permissions. I thought this was part of the manifest deployment but I do not recall which SA we use for LFME
There was a problem hiding this comment.
We do not need to create these clusterroles and I only have this here for tests to work. I've noted in the PR description that his can be removed when #3238 is merged and then we only need to reconcile the clusterrolebinding
Description
RBACfor theLFMEServiceAccount to performTokenReviewandSubjectAccessReviewAPI calls, enablingserver-side bearer token validation on the metrics endpoint
-secureMetricsflag to the LFME binary so the auth middleware is activeServiceMonitorto include the Prometheus bearer token when scrapingShould land #3238 first before this PR
This PR also requires changes in the
LFMEfor metrics to be secured.See: ViaQ/log-file-metric-exporter#42
/cc @cahartma @vparfonov
/assign @jcantrill
Links