Skip to content

Commit dc91a7f

Browse files
committed
BUG/MEDIUM: cluster: do not request for cert if cert was received
if certificate was received during node registration, do not initiate loop that starts certificate fetch.
1 parent eed4863 commit dc91a7f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

configuration/cluster_sync.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ func (c *ClusterSync) monitorBootstrapKey() {
202202
break
203203
}
204204
if key == c.cfg.Cluster.ActiveBootstrapKey.Load() {
205-
fetched := c.cfg.Cluster.CertificateFetched.Load()
206-
if !fetched {
205+
if !c.cfg.Cluster.CertificateFetched.Load() {
207206
c.certFetch <- struct{}{}
208207
}
209208
break
@@ -258,7 +257,9 @@ func (c *ClusterSync) monitorBootstrapKey() {
258257
log.Warning(err)
259258
break
260259
}
261-
c.certFetch <- struct{}{}
260+
if !c.cfg.Cluster.CertificateFetched.Load() {
261+
c.certFetch <- struct{}{}
262+
}
262263
case <-c.Context.Done():
263264
return
264265
}
@@ -461,7 +462,9 @@ func (c *ClusterSync) activateFetchCert(err error) {
461462
go func(err error) {
462463
log.Warning(err)
463464
time.Sleep(1 * time.Minute)
464-
c.certFetch <- struct{}{}
465+
if !c.cfg.Cluster.CertificateFetched.Load() {
466+
c.certFetch <- struct{}{}
467+
}
465468
}(err)
466469
}
467470

@@ -528,7 +531,9 @@ func (c *ClusterSync) fetchCert() {
528531
}
529532
if !certFetched {
530533
time.AfterFunc(time.Minute, func() {
531-
c.certFetch <- struct{}{}
534+
if !c.cfg.Cluster.CertificateFetched.Load() {
535+
c.certFetch <- struct{}{}
536+
}
532537
})
533538
}
534539
}

0 commit comments

Comments
 (0)