-
Notifications
You must be signed in to change notification settings - Fork 140
feat: expose and secure controller-runtime metrics #1369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: expose and secure controller-runtime metrics #1369
Conversation
6e81c7e to
6058c96
Compare
There was a problem hiding this 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.
|
| Status | Scanner | 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.
92b7817 to
775f96e
Compare
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]>
8ee8e04 to
dbf3112
Compare
Signed-off-by: Karsten Ludwig Hauser <[email protected]>
dbf3112 to
2c85d48
Compare
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
Fixes #1123