diff --git a/controllers/admiralty.go b/controllers/admiralty.go index 04f91bd..cc8191f 100644 --- a/controllers/admiralty.go +++ b/controllers/admiralty.go @@ -347,7 +347,7 @@ func (c *AdmiraltyController) GetNodeReady(){ return } - node, err := serv.GetOneNode(c.Ctx.Request.Context(),execution) + node, err := serv.GetOneNode(c.Ctx.Request.Context(),execution, peerId) if err != nil { // change code to 500 c.Ctx.Output.SetStatus(500) diff --git a/infrastructure/interface.go b/infrastructure/interface.go index e8c81d3..b51a368 100644 --- a/infrastructure/interface.go +++ b/infrastructure/interface.go @@ -20,7 +20,7 @@ type Infrastructure interface { CreateKubeconfigSecret(context context.Context, kubeconfig string, executionId string, peerId string) ([]byte, error) GetKubeconfigSecret(context context.Context, executionId string, peerId string) ([]byte, error) CreateAdmiraltyTarget(context context.Context, executionId string, peerId string)([]byte,error) - GetOneNode(context context.Context, executionID string) (*v1.Node, error) + GetOneNode(context context.Context, executionID string, peerId string) (*v1.Node, error) } var _service = map[string]func() (Infrastructure, error){ diff --git a/infrastructure/kubernetes.go b/infrastructure/kubernetes.go index 6b6226b..55eb4e8 100644 --- a/infrastructure/kubernetes.go +++ b/infrastructure/kubernetes.go @@ -510,7 +510,9 @@ func putCDRapiKube(client kubernetes.Clientset, ctx context.Context, path string // Returns the Kubernetes' Node object corresponding to the executionID if it exists on this host // // The node is created when an admiralty Target (on host) can connect to an admiralty Source (on remote) -func (k *KubernetesService) GetOneNode(context context.Context, executionID string) (*v1.Node, error) { +func (k *KubernetesService) GetOneNode(context context.Context, executionID string, peerId string) (*v1.Node, error) { + concatenatedName := getConcatenatedName(peerId, executionID) + res, err := k.Set.CoreV1(). Nodes(). List( @@ -524,7 +526,7 @@ func (k *KubernetesService) GetOneNode(context context.Context, executionID stri } for _, node := range res.Items { - if isNode := strings.Contains(node.Name, "admiralty-"+executionID+"-target-"+executionID+"-"); isNode { + if isNode := strings.Contains(node.Name, "admiralty-"+ concatenatedName +"-target-"+ concatenatedName + "-"); isNode { return &node, nil } }