added node to the returned data when it was found

This commit is contained in:
pb 2025-04-01 11:46:32 +02:00
parent b08e6a1e70
commit 4bfb16cba6

View File

@ -345,6 +345,8 @@ func (c *AdmiraltyController) GetNodeReady(){
return return
} }
resp, err := serv.GetKubeconfigSecret(c.Ctx.Request.Context(),execution) resp, err := serv.GetKubeconfigSecret(c.Ctx.Request.Context(),execution)
if err != nil { if err != nil {
// change code to 500 // change code to 500
@ -360,7 +362,6 @@ func (c *AdmiraltyController) GetNodeReady(){
return return
} }
// Extract JWT token RS265 encoded // Extract JWT token RS265 encoded
var editedKubeconfig map[string]interface{} var editedKubeconfig map[string]interface{}
json.Unmarshal(resp,&secret) json.Unmarshal(resp,&secret)
@ -393,14 +394,15 @@ func (c *AdmiraltyController) GetNodeReady(){
} }
if *isExpired { if *isExpired {
c.Data["json"] = map[string]string{ c.Data["json"] = map[string]interface{}{
"token" : "token in the secret is expired and must be regenerated", "token" : "token in the secret is expired and must be regenerated",
"node": node,
} }
c.Ctx.Output.SetStatus(410) c.Ctx.Output.SetStatus(410)
c.ServeJSON() c.ServeJSON()
} }
c.Data["json"] = map[string]bool{"ok": true} c.Data["json"] = map[string]interface{}{"node": node,"token": true}
c.ServeJSON() c.ServeJSON()
} }