MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / IsExpiring

Method IsExpiring

pkg/certs/certs.go:326–341  ·  view source on GitHub ↗

IsExpiring check if the certificate will expire in the configured duration

()

Source from the content-addressed store, hash-verified

324
325// IsExpiring check if the certificate will expire in the configured duration
326func (pair *KeyPair) IsExpiring() (bool, *time.Time, error) {
327 cert, err := pair.ParseCertificate()
328 if err != nil {
329 return true, nil, err
330 }
331
332 if time.Now().Before(cert.NotBefore) {
333 return true, &cert.NotAfter, nil
334 }
335 expiringCheckThreshold := getCheckThreshold()
336 if time.Now().Add(expiringCheckThreshold).After(cert.NotAfter) {
337 return true, &cert.NotAfter, nil
338 }
339
340 return false, &cert.NotAfter, nil
341}
342
343// DoAltDNSNamesMatch checks if the certificate has all of the specified altDNSNames
344func (pair *KeyPair) DoAltDNSNamesMatch(altDNSNames []string) (bool, error) {

Callers 7

verifyCAValidityMethod · 0.95
setCertExpirationMethod · 0.95
RenewLeafCertificateFunction · 0.80
renewCACertificateFunction · 0.80
certs_test.goFile · 0.80
renewCASecretMethod · 0.80

Calls 2

ParseCertificateMethod · 0.95
getCheckThresholdFunction · 0.85

Tested by

no test coverage detected