@@ -13,6 +13,7 @@ import (
1313 "os"
1414 "path/filepath"
1515 "strings"
16+ "sync"
1617 "time"
1718
1819 logf "github.com/openshift/router/log"
6667 CRLFilename = filepath .Join (mtlsLatestSymlink , crlBasename )
6768 // CABundleFilename is the fully qualified path to the currently in use CA bundle.
6869 CABundleFilename = filepath .Join (mtlsLatestSymlink , caBundleBasename )
70+ // crlsUpdated is true when all CRLs have been successfully updated, and false when there are missing CRLs.
71+ crlsUpdated = false
72+ crlsMutex = sync.Mutex {}
6973)
7074
7175// authorityKeyIdentifier is a certificate's authority key identifier.
@@ -143,19 +147,24 @@ func ManageCRLs(caBundleFilename string, caUpdateChannel <-chan struct{}, update
143147 log .Error (err , "failed to parse CA bundle" , "CA bundle filename" , caBundleFilename )
144148 nextUpdate = time .Now ().Add (errorBackoffTime )
145149 }
150+ if ! shouldHaveCRLs {
151+ SetCRLsUpdated (true )
152+ }
146153 for {
147154 updated := false
148155 if nextUpdate .IsZero () {
149156 log .V (4 ).Info ("no nextUpdate. only watching for CA updates" )
150157 select {
151158 case <- caUpdateChannel :
159+ SetCRLsUpdated (false )
152160 caUpdated = true
153161 }
154162 } else {
155163 log .V (4 ).Info ("nextUpdate is at " + nextUpdate .Format (time .RFC3339 ))
156164 select {
157165 case <- time .After (time .Until (nextUpdate )):
158166 case <- caUpdateChannel :
167+ SetCRLsUpdated (false )
159168 caUpdated = true
160169 }
161170 }
@@ -175,8 +184,9 @@ func ManageCRLs(caBundleFilename string, caUpdateChannel <-chan struct{}, update
175184 nextUpdate = time .Now ().Add (errorBackoffTime )
176185 continue
177186 }
178- // After successfully updating the CRL file, reset caUpdated
187+ // After successfully updating the CRL file, reset caUpdated and mark CRLs as updated
179188 caUpdated = false
189+ SetCRLsUpdated (true )
180190 if updated {
181191 updateCallback (shouldHaveCRLs )
182192 }
@@ -506,3 +516,15 @@ func makeStagingDirectory() (string, error) {
506516 }
507517 return stagingDirName , nil
508518}
519+
520+ func GetCRLsUpdated () bool {
521+ crlsMutex .Lock ()
522+ defer crlsMutex .Unlock ()
523+ return crlsUpdated
524+ }
525+
526+ func SetCRLsUpdated (value bool ) {
527+ crlsMutex .Lock ()
528+ defer crlsMutex .Unlock ()
529+ crlsUpdated = value
530+ }
0 commit comments