Skip to content

Conversation

@khauser
Copy link

@khauser khauser commented Nov 1, 2025

According to https://book.kubebuilder.io/reference/metrics.html the metrics endpoint could be secured by the controller-runtime itself without utilizing kube-rbac-proxy.

Checklist

  • Commits are signed with Developer Certificate of Origin (DCO)
  • Changelog has been updated and is aligned with our changelog requirements

Fixes #1123

@khauser khauser force-pushed the copilot/update-http-addon-rbac-permissions-again branch from 6e81c7e to 6058c96 Compare November 1, 2025 19:18
@khauser khauser changed the title Copilot/update http addon rbac permissions again feat: expose and secure controller-runtime metrics Nov 3, 2025
@wozniakjan wozniakjan requested a review from Copilot November 18, 2025 09:21
Copilot finished reviewing on behalf of wozniakjan November 18, 2025 09:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR secures the controller-runtime metrics endpoint by enabling built-in HTTPS and RBAC authentication/authorization, eliminating the need for kube-rbac-proxy. The metrics endpoint is changed from port 8080 to 8443 with TLS enabled.

  • Changed metrics endpoint from HTTP on port 8080 to HTTPS on port 8443 with built-in authentication and authorization
  • Added RBAC permissions for TokenReviews and SubjectAccessReviews to enable metrics endpoint authentication
  • Added comprehensive E2E tests to verify secured metrics endpoint functionality

Reviewed Changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
operator/main.go Enables secure serving on metrics endpoint (port 8443) with authentication and authorization filters
config/operator/deployment.yaml Updates metrics container port from 8080 to 8443
config/operator/role.yaml Adds permissions for authentication.k8s.io and authorization.k8s.io APIs required for metrics authentication
config/operator/role_binding.yaml Adds system:auth-delegator ClusterRoleBinding and updates service account references
config/operator/metrics_service.yaml Creates new Service resource to expose secured metrics endpoint
config/operator/metrics_reader_role.yaml Defines ClusterRole for reading metrics via non-resource URLs
config/operator/kustomization.yaml Includes new metrics service and reader role resources
tests/checks/operator_metrics/operator_metrics_test.go Adds E2E tests to verify HTTPS metrics endpoint and RBAC authorization
tests/utils/setup_test.go Fixes missing selector labels in opentelemetry-collector deployment
go.mod Adds new dependencies for authentication/authorization features
go.sum Updates checksums for new and updated dependencies
CHANGELOG.md Documents removal of kube-rbac-proxy in v0.12.0
.gitignore Adds *.test to ignore compiled test binaries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@snyk-io
Copy link

snyk-io bot commented Nov 19, 2025

⚠️ Snyk checks are incomplete.

Status Scanner Critical High Medium Low Total (0)
⚠️ Open Source Security 0 0 0 0 See details

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@khauser khauser force-pushed the copilot/update-http-addon-rbac-permissions-again branch from 92b7817 to 775f96e Compare November 19, 2025 08:17
Copilot AI and others added 5 commits November 19, 2025 09:21
Signed-off-by: Karsten Ludwig Hauser <[email protected]>
…orization

- Updated operator/main.go to configure metrics server with SecureServing on port 8443
- Added WithAuthenticationAndAuthorization filter for metrics endpoint
- Updated deployment to use port 8443 for metrics
- Created metrics service for operator
- Added RBAC permissions for TokenReviews and SubjectAccessReviews
- Created ClusterRole for metrics reader access
- Added e2e test for operator metrics endpoint
- Updated go.mod and go.sum with required dependencies

Co-authored-by: khauser <[email protected]>
Signed-off-by: Karsten Ludwig Hauser <[email protected]>
…ments

Co-authored-by: khauser <[email protected]>
Signed-off-by: Karsten Ludwig Hauser <[email protected]>
Added release notes for version 0.12.0, including improvements.

Signed-off-by: Karsten Ludwig Hauser <[email protected]>
Signed-off-by: Karsten Ludwig Hauser <[email protected]>
Signed-off-by: Karsten Ludwig Hauser <[email protected]>
@khauser khauser force-pushed the copilot/update-http-addon-rbac-permissions-again branch 3 times, most recently from 8ee8e04 to dbf3112 Compare November 19, 2025 12:17
Signed-off-by: Karsten Ludwig Hauser <[email protected]>
@khauser khauser force-pushed the copilot/update-http-addon-rbac-permissions-again branch from dbf3112 to 2c85d48 Compare November 19, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Critical Vulnerability - CVE-2024-24790

2 participants