@@ -16,23 +16,30 @@ const (
16
16
CertificateIssuer = "auth.openshift.io/certificate-issuer"
17
17
// CertificateHostnames contains the hostnames used by a signer.
18
18
CertificateHostnames = "auth.openshift.io/certificate-hostnames"
19
- // AutoRegenerateAfterOfflineExpiryAnnotation contains a link to PR and an e2e test name which verifies
19
+ // CertificateTestNameAnnotation is an e2e test name which verifies that TLS artifact is created and used correctly
20
+ CertificateTestNameAnnotation string = "certificates.openshift.io/test-name"
21
+ // CertificateAutoRegenerateAfterOfflineExpiryAnnotation contains a link to PR adding this annotation which verifies
20
22
// that TLS artifact is correctly regenerated after it has expired
21
- AutoRegenerateAfterOfflineExpiryAnnotation string = "certificates.openshift.io/auto-regenerate-after-offline-expiry"
23
+ CertificateAutoRegenerateAfterOfflineExpiryAnnotation string = "certificates.openshift.io/auto-regenerate-after-offline-expiry"
24
+ // CertificateRefreshPeriodAnnotation is the interval at which the certificate should be refreshed.
25
+ CertificateRefreshPeriodAnnotation string = "certificates.openshift.io/refresh-period"
22
26
)
23
27
24
28
type AdditionalAnnotations struct {
25
29
// JiraComponent annotates tls artifacts so that owner could be easily found
26
30
JiraComponent string
27
31
// Description is a human-readable one sentence description of certificate purpose
28
32
Description string
29
- // AutoRegenerateAfterOfflineExpiry contains a link to PR and an e2e test name which verifies
30
- // that TLS artifact is correctly regenerated after it has expired
33
+ // TestName is an e2e test name which verifies that TLS artifact is created and used correctly
34
+ TestName string
35
+ // AutoRegenerateAfterOfflineExpiry contains a link to PR which adds this annotation on the TLS artifact
31
36
AutoRegenerateAfterOfflineExpiry string
32
37
// NotBefore contains certificate the certificate creation date in RFC3339 format.
33
38
NotBefore string
34
39
// NotAfter contains certificate the certificate validity date in RFC3339 format.
35
40
NotAfter string
41
+ // RefreshPeriod contains the interval at which the certificate should be refreshed.
42
+ RefreshPeriod string
36
43
}
37
44
38
45
func (a AdditionalAnnotations ) EnsureTLSMetadataUpdate (meta * metav1.ObjectMeta ) bool {
@@ -52,20 +59,36 @@ func (a AdditionalAnnotations) EnsureTLSMetadataUpdate(meta *metav1.ObjectMeta)
52
59
meta .Annotations [annotations .OpenShiftDescription ] = a .Description
53
60
modified = true
54
61
}
55
- if len (a .AutoRegenerateAfterOfflineExpiry ) > 0 && meta .Annotations [AutoRegenerateAfterOfflineExpiryAnnotation ] != a .AutoRegenerateAfterOfflineExpiry {
56
- diff := cmp .Diff (meta .Annotations [AutoRegenerateAfterOfflineExpiryAnnotation ], a .AutoRegenerateAfterOfflineExpiry )
57
- klog .V (2 ).Infof ("Updating %q annotation for %s/%s, diff: %s" , AutoRegenerateAfterOfflineExpiryAnnotation , meta .Namespace , meta .Name , diff )
58
- meta .Annotations [AutoRegenerateAfterOfflineExpiryAnnotation ] = a .AutoRegenerateAfterOfflineExpiry
62
+ if len (a .TestName ) > 0 && meta .Annotations [CertificateTestNameAnnotation ] != a .TestName {
63
+ diff := cmp .Diff (meta .Annotations [CertificateTestNameAnnotation ], a .TestName )
64
+ klog .V (2 ).Infof ("Updating %q annotation for %s/%s, diff: %s" , CertificateTestNameAnnotation , meta .Name , meta .Namespace , diff )
65
+ meta .Annotations [CertificateTestNameAnnotation ] = a .TestName
66
+ modified = true
67
+ }
68
+ if len (a .AutoRegenerateAfterOfflineExpiry ) > 0 && meta .Annotations [CertificateAutoRegenerateAfterOfflineExpiryAnnotation ] != a .AutoRegenerateAfterOfflineExpiry {
69
+ diff := cmp .Diff (meta .Annotations [CertificateAutoRegenerateAfterOfflineExpiryAnnotation ], a .AutoRegenerateAfterOfflineExpiry )
70
+ klog .V (2 ).Infof ("Updating %q annotation for %s/%s, diff: %s" , CertificateAutoRegenerateAfterOfflineExpiryAnnotation , meta .Namespace , meta .Name , diff )
71
+ meta .Annotations [CertificateAutoRegenerateAfterOfflineExpiryAnnotation ] = a .AutoRegenerateAfterOfflineExpiry
59
72
modified = true
60
73
}
61
74
if len (a .NotBefore ) > 0 && meta .Annotations [CertificateNotBeforeAnnotation ] != a .NotBefore {
75
+ diff := cmp .Diff (meta .Annotations [CertificateNotBeforeAnnotation ], a .NotBefore )
76
+ klog .V (2 ).Infof ("Updating %q annotation for %s/%s, diff: %s" , CertificateNotBeforeAnnotation , meta .Name , meta .Namespace , diff )
62
77
meta .Annotations [CertificateNotBeforeAnnotation ] = a .NotBefore
63
78
modified = true
64
79
}
65
80
if len (a .NotAfter ) > 0 && meta .Annotations [CertificateNotAfterAnnotation ] != a .NotAfter {
81
+ diff := cmp .Diff (meta .Annotations [CertificateNotAfterAnnotation ], a .NotAfter )
82
+ klog .V (2 ).Infof ("Updating %q annotation for %s/%s, diff: %s" , CertificateNotAfterAnnotation , meta .Name , meta .Namespace , diff )
66
83
meta .Annotations [CertificateNotAfterAnnotation ] = a .NotAfter
67
84
modified = true
68
85
}
86
+ if len (a .RefreshPeriod ) > 0 && meta .Annotations [CertificateRefreshPeriodAnnotation ] != a .RefreshPeriod {
87
+ diff := cmp .Diff (meta .Annotations [CertificateRefreshPeriodAnnotation ], a .RefreshPeriod )
88
+ klog .V (2 ).Infof ("Updating %q annotation for %s/%s, diff: %s" , CertificateRefreshPeriodAnnotation , meta .Name , meta .Namespace , diff )
89
+ meta .Annotations [CertificateRefreshPeriodAnnotation ] = a .RefreshPeriod
90
+ modified = true
91
+ }
69
92
return modified
70
93
}
71
94
0 commit comments