Merge pull request #103862 from tanjing2020/cleancode

Replace 'x.Sub(time.Now())' with 'time.Until(x)'
This commit is contained in:
Kubernetes Prow Robot 2021-08-17 11:42:01 -07:00 committed by GitHub
commit 07b7afefbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -892,7 +892,7 @@ func buildKubeletClientConfig(ctx context.Context, s *options.KubeletServer, nod
},
func() float64 {
if c := clientCertificateManager.Current(); c != nil && c.Leaf != nil {
return math.Trunc(c.Leaf.NotAfter.Sub(time.Now()).Seconds())
return math.Trunc(time.Until(c.Leaf.NotAfter).Seconds())
}
return math.Inf(1)
},

View File

@ -141,7 +141,7 @@ func NewKubeletServerCertificateManager(kubeClient clientset.Interface, kubeCfg
},
func() float64 {
if c := m.Current(); c != nil && c.Leaf != nil {
return math.Trunc(c.Leaf.NotAfter.Sub(time.Now()).Seconds())
return math.Trunc(time.Until(c.Leaf.NotAfter).Seconds())
}
return math.Inf(1)
},