mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-04 08:35:10 +00:00
Changed Kubelet client and serving cert TTL/Expiry certs to use gaugefunc for calculating time remaining.
Kubernetes-commit: aba0b315269dab469694af7fca879438a7f87e41
This commit is contained in:
committed by
Kubernetes Publisher
parent
bc9b51d240
commit
41735bf478
@@ -31,9 +31,9 @@ type DurationMetric interface {
|
||||
Observe(duration time.Duration)
|
||||
}
|
||||
|
||||
// TTLMetric sets the time to live of something.
|
||||
type TTLMetric interface {
|
||||
Set(ttl *time.Duration)
|
||||
// ExpiryMetric sets some time of expiry. If nil, assume not relevant.
|
||||
type ExpiryMetric interface {
|
||||
Set(expiry *time.Time)
|
||||
}
|
||||
|
||||
// LatencyMetric observes client latency partitioned by verb and url.
|
||||
@@ -47,8 +47,8 @@ type ResultMetric interface {
|
||||
}
|
||||
|
||||
var (
|
||||
// ClientCertTTL is the time to live of a client certificate
|
||||
ClientCertTTL TTLMetric = noopTTL{}
|
||||
// ClientCertExpiry is the expiry time of a client certificate
|
||||
ClientCertExpiry ExpiryMetric = noopExpiry{}
|
||||
// ClientCertRotationAge is the age of a certificate that has just been rotated.
|
||||
ClientCertRotationAge DurationMetric = noopDuration{}
|
||||
// RequestLatency is the latency metric that rest clients will update.
|
||||
@@ -59,7 +59,7 @@ var (
|
||||
|
||||
// RegisterOpts contains all the metrics to register. Metrics may be nil.
|
||||
type RegisterOpts struct {
|
||||
ClientCertTTL TTLMetric
|
||||
ClientCertExpiry ExpiryMetric
|
||||
ClientCertRotationAge DurationMetric
|
||||
RequestLatency LatencyMetric
|
||||
RequestResult ResultMetric
|
||||
@@ -69,8 +69,8 @@ type RegisterOpts struct {
|
||||
// only be called once.
|
||||
func Register(opts RegisterOpts) {
|
||||
registerMetrics.Do(func() {
|
||||
if opts.ClientCertTTL != nil {
|
||||
ClientCertTTL = opts.ClientCertTTL
|
||||
if opts.ClientCertExpiry != nil {
|
||||
ClientCertExpiry = opts.ClientCertExpiry
|
||||
}
|
||||
if opts.ClientCertRotationAge != nil {
|
||||
ClientCertRotationAge = opts.ClientCertRotationAge
|
||||
@@ -88,9 +88,9 @@ type noopDuration struct{}
|
||||
|
||||
func (noopDuration) Observe(time.Duration) {}
|
||||
|
||||
type noopTTL struct{}
|
||||
type noopExpiry struct{}
|
||||
|
||||
func (noopTTL) Set(*time.Duration) {}
|
||||
func (noopExpiry) Set(*time.Time) {}
|
||||
|
||||
type noopLatency struct{}
|
||||
|
||||
|
Reference in New Issue
Block a user