@@ -884,6 +884,32 @@ func (r *OVNControllerReconciler) reconcileNormal(ctx context.Context, instance
884884 return ctrl.Result {}, podErr
885885 }
886886
887+ issuer := & certmgrv1.Issuer {}
888+ if err := helper .GetClient ().Get (ctx , types.NamespacedName {
889+ Name : instance .Spec .OvnIssuerName ,
890+ Namespace : instance .Namespace ,
891+ }, issuer ); err != nil {
892+ return ctrl.Result {}, fmt .Errorf ("error getting issuer %s/%s - %w" , instance .Spec .OvnIssuerName , instance .Namespace , err )
893+ }
894+
895+ durationString := certmanager .CertDefaultDuration
896+ if d , ok := issuer .Annotations [certmanager .CertDurationAnnotation ]; ok && d != "" {
897+ durationString = d
898+ }
899+ duration , err := time .ParseDuration (durationString )
900+ if err != nil {
901+ return ctrl.Result {}, fmt .Errorf ("error parsing certificate duration %s - %w" , durationString , err )
902+ }
903+
904+ var renewBefore * time.Duration
905+ if r , ok := issuer .Annotations [certmanager .CertRenewBeforeAnnotation ]; ok && r != "" {
906+ rb , err := time .ParseDuration (r )
907+ if err != nil {
908+ return ctrl.Result {}, fmt .Errorf ("error parsing certificate renewBefore %s - %w" , r , err )
909+ }
910+ renewBefore = & rb
911+ }
912+
887913 for _ , pod := range ovnPods .Items {
888914 nodeName := pod .Spec .NodeName
889915 if nodeName == "" {
@@ -894,11 +920,13 @@ func (r *OVNControllerReconciler) reconcileNormal(ctx context.Context, instance
894920 nodeSystemIDs [nodeName ] = systemID
895921
896922 _ , certResult , certErr := certmanager .EnsureCert (ctx , helper , certmanager.CertificateRequest {
897- IssuerName : instance .Spec .OvnIssuerName ,
898- CertName : certName ,
899- CommonName : & systemID ,
900- Labels : ovnServiceLabels ,
901- Usages : []certmgrv1.KeyUsage {certmgrv1 .UsageClientAuth , certmgrv1 .UsageDigitalSignature },
923+ IssuerName : instance .Spec .OvnIssuerName ,
924+ CertName : certName ,
925+ CommonName : & systemID ,
926+ Labels : ovnServiceLabels ,
927+ Usages : []certmgrv1.KeyUsage {certmgrv1 .UsageClientAuth , certmgrv1 .UsageDigitalSignature },
928+ Duration : & duration ,
929+ RenewBefore : renewBefore ,
902930 }, instance )
903931 if certErr != nil {
904932 return certResult , certErr
0 commit comments