mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
447360c1f3
* refactor: improve instrumented clients creation Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * refactor: instrumented clients code part 3 Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * metadata Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * metadata Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
42 lines
1.9 KiB
Go
42 lines
1.9 KiB
Go
package client
|
|
|
|
import (
|
|
certificatesigningrequests "github.com/kyverno/kyverno/pkg/clients/kube/certificatesv1/certificatesigningrequests"
|
|
"github.com/kyverno/kyverno/pkg/metrics"
|
|
k8s_io_client_go_kubernetes_typed_certificates_v1 "k8s.io/client-go/kubernetes/typed/certificates/v1"
|
|
"k8s.io/client-go/rest"
|
|
)
|
|
|
|
func WithMetrics(inner k8s_io_client_go_kubernetes_typed_certificates_v1.CertificatesV1Interface, metrics metrics.MetricsConfigManager, clientType metrics.ClientType) k8s_io_client_go_kubernetes_typed_certificates_v1.CertificatesV1Interface {
|
|
return &withMetrics{inner, metrics, clientType}
|
|
}
|
|
|
|
func WithTracing(inner k8s_io_client_go_kubernetes_typed_certificates_v1.CertificatesV1Interface, client string) k8s_io_client_go_kubernetes_typed_certificates_v1.CertificatesV1Interface {
|
|
return &withTracing{inner, client}
|
|
}
|
|
|
|
type withMetrics struct {
|
|
inner k8s_io_client_go_kubernetes_typed_certificates_v1.CertificatesV1Interface
|
|
metrics metrics.MetricsConfigManager
|
|
clientType metrics.ClientType
|
|
}
|
|
|
|
func (c *withMetrics) RESTClient() rest.Interface {
|
|
return c.inner.RESTClient()
|
|
}
|
|
func (c *withMetrics) CertificateSigningRequests() k8s_io_client_go_kubernetes_typed_certificates_v1.CertificateSigningRequestInterface {
|
|
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "CertificateSigningRequest", c.clientType)
|
|
return certificatesigningrequests.WithMetrics(c.inner.CertificateSigningRequests(), recorder)
|
|
}
|
|
|
|
type withTracing struct {
|
|
inner k8s_io_client_go_kubernetes_typed_certificates_v1.CertificatesV1Interface
|
|
client string
|
|
}
|
|
|
|
func (c *withTracing) RESTClient() rest.Interface {
|
|
return c.inner.RESTClient()
|
|
}
|
|
func (c *withTracing) CertificateSigningRequests() k8s_io_client_go_kubernetes_typed_certificates_v1.CertificateSigningRequestInterface {
|
|
return certificatesigningrequests.WithTracing(c.inner.CertificateSigningRequests(), c.client, "CertificateSigningRequest")
|
|
}
|