mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #103862 from tanjing2020/cleancode
Replace 'x.Sub(time.Now())' with 'time.Until(x)'
This commit is contained in:
commit
07b7afefbf
@ -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)
|
||||
},
|
||||
|
@ -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)
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user