@@ -252,7 +252,11 @@ func (c *ClusterSync) monitorBootstrapKey() {
252
252
if err != nil {
253
253
log .Panic (err )
254
254
}
255
- err = c .issueJoinRequest (url , data ["port" ], data ["api-base-path" ], c .cfg .Cluster .APIRegisterPath .Load (), csr , key )
255
+ registerMerhod := "POST"
256
+ if method , ok := data ["register-method" ]; ok {
257
+ registerMerhod = method
258
+ }
259
+ err = c .issueJoinRequest (url , data ["port" ], data ["api-base-path" ], c .cfg .Cluster .APIRegisterPath .Load (), registerMerhod , csr , key )
256
260
if err != nil {
257
261
log .Warning (err )
258
262
break
@@ -266,7 +270,7 @@ func (c *ClusterSync) monitorBootstrapKey() {
266
270
}
267
271
}
268
272
269
- func (c * ClusterSync ) issueJoinRequest (url , port , basePath string , registerPath string , csr , key string ) error {
273
+ func (c * ClusterSync ) issueJoinRequest (url , port , basePath string , registerPath string , registerMethod string , csr , key string ) error {
270
274
url = fmt .Sprintf ("%s:%s/%s" , url , port , strings .TrimLeft (path .Join (basePath , registerPath ), "/" ))
271
275
apiCfg := c .cfg .APIOptions
272
276
userStore := GetUsersStore ()
@@ -340,9 +344,9 @@ func (c *ClusterSync) issueJoinRequest(url, port, basePath string, registerPath
340
344
341
345
bytesRepresentation , _ := json .Marshal (nodeData )
342
346
343
- req , err := http .NewRequest ("POST" , url , bytes .NewBuffer (bytesRepresentation ))
347
+ req , err := http .NewRequest (registerMethod , url , bytes .NewBuffer (bytesRepresentation ))
344
348
if err != nil {
345
- return fmt .Errorf ("error creating new POST request for cluster comunication" )
349
+ return fmt .Errorf ("error creating new %s request for cluster comunication" , registerMethod )
346
350
}
347
351
req .Header .Add ("X-Bootstrap-Key" , c .cfg .Cluster .BootstrapKey .Load ())
348
352
req .Header .Add ("Content-Type" , "application/json" )
0 commit comments