mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Make expired cert check more clear.
This commit is contained in:
parent
2b00d36241
commit
7549b4184f
@ -70,7 +70,7 @@ func rollbackFiles(files map[string]string, originalErr error) error {
|
|||||||
// shouldBackupAPIServerCertAndKey check if the new k8s version is at least 1.9.0
|
// shouldBackupAPIServerCertAndKey check if the new k8s version is at least 1.9.0
|
||||||
// and kube-apiserver will be expired in 60 days.
|
// and kube-apiserver will be expired in 60 days.
|
||||||
func shouldBackupAPIServerCertAndKey(newK8sVer *version.Version) (bool, error) {
|
func shouldBackupAPIServerCertAndKey(newK8sVer *version.Version) (bool, error) {
|
||||||
if !newK8sVer.LessThan(v190) {
|
if newK8sVer.LessThan(v190) {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ func shouldBackupAPIServerCertAndKey(newK8sVer *version.Version) (bool, error) {
|
|||||||
return false, fmt.Errorf("no certificate data found")
|
return false, fmt.Errorf("no certificate data found")
|
||||||
}
|
}
|
||||||
|
|
||||||
if certs[0].NotAfter.Sub(time.Now()) < 60*24*time.Hour {
|
if time.Now().Sub(certs[0].NotBefore) > 180*24*time.Hour {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user