diff --git a/infrastructure/kubernetes.go b/infrastructure/kubernetes.go index e8e9b98..5fb285e 100644 --- a/infrastructure/kubernetes.go +++ b/infrastructure/kubernetes.go @@ -309,7 +309,7 @@ func (k *KubernetesService) CreateAdmiraltyTarget(context context.Context,execut }, } - res, err := dynamicClientApply(executionId, gvrTargets, context, target) + res, err := dynamicClientApply(executionId, "target", gvrTargets, context, target) if err != nil { return nil, errors.New("Error when trying to apply Source definition :" + err.Error()) } @@ -342,7 +342,7 @@ func (k *KubernetesService) CreateAdmiraltySource(context context.Context,execut } - res, err := dynamicClientApply(executionId, gvrSources, context, source) + res, err := dynamicClientApply(executionId, "source",gvrSources, context, source) if err != nil { return nil, errors.New("Error when trying to apply Source definition :" + err.Error()) } @@ -452,7 +452,7 @@ func getCDRapiKube(client kubernetes.Clientset, ctx context.Context, path string return resp, nil } -func dynamicClientApply(executionId string, resourceDefinition schema.GroupVersionResource, ctx context.Context, object map[string]interface{}) ([]byte, error) { +func dynamicClientApply(executionId string, typeResource string, resourceDefinition schema.GroupVersionResource, ctx context.Context, object map[string]interface{}) ([]byte, error) { cli, err := NewDynamicClient() if err != nil { return nil, errors.New("Could not retrieve dynamic client when creating Admiralty Source : " + err.Error()) @@ -461,7 +461,7 @@ func dynamicClientApply(executionId string, resourceDefinition schema.GroupVersi res, err := cli.Resource(resourceDefinition). Namespace(executionId). Apply(ctx, - "source-"+executionId, + typeResource + "-" + executionId, &unstructured.Unstructured{Object: object}, metav1.ApplyOptions{ FieldManager: "kubectl-client-side-apply",