package filters
import "sigs.k8s.io/controller-runtime/pkg/metrics/filters"
Index ¶
Functions ¶
func WithAuthenticationAndAuthorization ¶
func WithAuthenticationAndAuthorization(config *rest.Config, httpClient *http.Client) (metricsserver.Filter, error)
WithAuthenticationAndAuthorization provides a metrics.Filter for authentication and authorization. Metrics will be authenticated (via TokenReviews) and authorized (via SubjectAccessReviews) with the kube-apiserver. For the authentication and authorization the controller needs a ClusterRole with the following rules: * apiGroups: authentication.k8s.io, resources: tokenreviews, verbs: create * apiGroups: authorization.k8s.io, resources: subjectaccessreviews, verbs: create
To scrape metrics e.g. via Prometheus the client needs a ClusterRole with the following rule: * nonResourceURLs: "/metrics", verbs: get
Note: Please note that configuring this metrics provider will introduce a dependency to "k8s.io/apiserver" to your go module.
Source Files ¶
filters.go
- Version
- v0.21.0 (latest)
- Published
- May 20, 2025
- Platform
- linux/amd64
- Imports
- 14 packages
- Last checked
- 26 minutes ago –
Tools for package owners.