@@ -198,10 +198,12 @@ func (c *ClusterSync) monitorBootstrapKey() {
198
198
for {
199
199
select {
200
200
case <- c .cfg .Notify .BootstrapKeyChanged .Subscribe ("monitorBootstrapKey" ):
201
+ log .Warningf ("detected change in configured bootstrap key" )
201
202
key := c .cfg .Cluster .BootstrapKey .Load ()
202
203
c .cfg .Cluster .CertificateFetched .Store (false )
203
204
if key == "" {
204
205
// do we need to delete cert here maybe?
206
+ log .Warningf ("setting bootstrap key to empty" )
205
207
c .cfg .Cluster .ActiveBootstrapKey .Store ("" )
206
208
err := c .cfg .Save ()
207
209
if err != nil {
@@ -270,12 +272,14 @@ func (c *ClusterSync) monitorBootstrapKey() {
270
272
if method , ok := data ["register-method" ]; ok {
271
273
registerMerhod = method
272
274
}
275
+ log .Warningf ("issuing cluster join request to cluster %s at %s" , data ["name" ], data ["address" ])
273
276
err = c .issueJoinRequest (url , data ["port" ], data ["api-base-path" ], c .cfg .Cluster .APIRegisterPath .Load (), registerMerhod , csr , key )
274
277
if err != nil {
275
278
log .Warning (err )
276
279
break
277
280
}
278
281
if ! c .cfg .Cluster .CertificateFetched .Load () {
282
+ log .Warningf ("starting certificate fetch" )
279
283
c .certFetch <- struct {}{}
280
284
}
281
285
case <- c .Context .Done ():
@@ -377,7 +381,9 @@ func (c *ClusterSync) issueJoinRequest(url, port, basePath string, registerPath
377
381
return err
378
382
}
379
383
if resp .StatusCode != expectedResponseCodes [registerMethod ] {
380
- return fmt .Errorf ("status code not proper [%d] %s" , resp .StatusCode , string (body ))
384
+ return fmt .Errorf ("invalid status code [%d] %s" , resp .StatusCode , string (body ))
385
+ } else {
386
+ log .Warningf ("success sending local info, joining in progress" )
381
387
}
382
388
var responseData Node
383
389
err = json .Unmarshal (body , & responseData )
@@ -444,7 +450,7 @@ func (c *ClusterSync) issueJoinRequest(url, port, basePath string, registerPath
444
450
c .cfg .Cluster .Name .Store (responseData .Name )
445
451
c .cfg .Cluster .Token .Store (resp .Header .Get ("X-Node-Key" ))
446
452
c .cfg .Cluster .ActiveBootstrapKey .Store (c .cfg .Cluster .BootstrapKey .Load ())
447
- log .Info ( "Cluster joined" )
453
+ log .Warning ( "cluster joined" )
448
454
_ , err = c .checkCertificate (responseData )
449
455
if err != nil {
450
456
return err
@@ -550,6 +556,7 @@ func (c *ClusterSync) fetchCert() {
550
556
if ! certFetched {
551
557
time .AfterFunc (time .Minute , func () {
552
558
if ! c .cfg .Cluster .CertificateFetched .Load () {
559
+ log .Warningf ("retrying certificate fetch" )
553
560
c .certFetch <- struct {}{}
554
561
}
555
562
})
0 commit comments