shortened how targets are named
This commit is contained in:
parent
ba940bfc80
commit
24e0137444
@ -292,13 +292,20 @@ func (k *KubernetesService) CreateAdmiraltyTarget(context context.Context, execu
|
||||
return nil, nil // Maybe we could create a wrapper for errors and add more info to have
|
||||
}
|
||||
|
||||
s := strings.Split(peerId, "-")[:2]
|
||||
p := s[0] + "-" + s[1]
|
||||
|
||||
targetName := "target-" + p + "-" + executionId
|
||||
|
||||
target := map[string]interface{}{
|
||||
"apiVersion": "multicluster.admiralty.io/v1alpha1",
|
||||
"kind": "Target",
|
||||
"metadata": map[string]interface{}{
|
||||
"name": "target-" + peerId + "-" +executionId,
|
||||
"name": targetName,
|
||||
"namespace": executionId,
|
||||
"labels": map[string]interface{}{
|
||||
"peer": peerId,
|
||||
},
|
||||
},
|
||||
"spec": map[string]interface{}{
|
||||
"kubeconfigSecret": map[string]string{
|
||||
@ -307,7 +314,7 @@ func (k *KubernetesService) CreateAdmiraltyTarget(context context.Context, execu
|
||||
},
|
||||
}
|
||||
|
||||
res, err := dynamicClientApply(executionId, "target-" + peerId + "-" +executionId, gvrTargets, context, target)
|
||||
res, err := dynamicClientApply(executionId, targetName, gvrTargets, context, target)
|
||||
if err != nil {
|
||||
return nil, errors.New("Error when trying to apply Target definition :" + err.Error())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user