Skip to content

Commit

Permalink
refactor: deprecate dataplane-selector-configuration in favor of data…
Browse files Browse the repository at this point in the history
…-plane-self-registration
  • Loading branch information
ndr-brt committed May 23, 2024
1 parent 14f59fc commit f3b25c6
Show file tree
Hide file tree
Showing 23 changed files with 61 additions and 162 deletions.
3 changes: 3 additions & 0 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,11 @@ maven/mavencentral/org.eclipse.edc/data-plane-http-oauth2/0.7.0, Apache-2.0, app
maven/mavencentral/org.eclipse.edc/data-plane-http-spi/0.7.0, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/data-plane-http/0.7.0, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/data-plane-public-api-v2/0.7.0, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/data-plane-selector-api/0.7.0, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/data-plane-selector-client/0.7.0, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/data-plane-selector-core/0.7.0, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/data-plane-selector-spi/0.7.0, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/data-plane-self-registration/0.7.0, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/data-plane-signaling-api-configuration/0.7.0, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/data-plane-signaling-api/0.7.0, Apache-2.0, approved, technology.edc
maven/mavencentral/org.eclipse.edc/data-plane-signaling-client/0.7.0, Apache-2.0, approved, technology.edc
Expand Down
9 changes: 8 additions & 1 deletion charts/tractusx-connector-azure-vault/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,19 @@ Validation URL
{{- end }}

{{/*
Control Plane URL
Control Plane Control URL
*/}}
{{- define "txdc.controlplane.url.control" -}}
{{- printf "http://%s-controlplane:%v%s" ( include "txdc.fullname" $ ) $.Values.controlplane.endpoints.control.port $.Values.controlplane.endpoints.control.path -}}
{{- end }}

{{/*
Data Plane Control URL
*/}}
{{- define "txdc.dataplane.url.control" -}}
{{- printf "http://%s-dataplane:%v%s" ( include "txdc.fullname" $ ) $.Values.dataplane.endpoints.control.port $.Values.dataplane.endpoints.control.path -}}
{{- end }}

{{/*
Data Signaling URL
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,25 +298,6 @@ spec:
value: {{ .Values.controlplane.bdrs.cache_validity_seconds | quote}}
{{- end}}

################
## DATA PLANE ##
################

# see extension https://github.com/eclipse-tractusx/tractusx-edc/tree/main/edc-extensions/dataplane-selector-configuration
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_URL"
value: {{ include "txdc.dataplane.url.signaling" . }}/v1/dataflows
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_TRANSFERTYPES"
value: "HttpData-PULL,HttpData-PUSH,AmazonS3-PUSH,AzureStorage-PUSH"
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_SOURCETYPES"
value: "HttpData,AmazonS3,AzureStorage"
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_DESTINATIONTYPES"
value: "HttpData,HttpProxy,AmazonS3,AzureStorage"
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_PROPERTIES"
value: |-
{{ printf "{ \"publicApiUrl\": \"%s\" }" (include "txdc.dataplane.url.public" . ) }}
###########
## VAULT ##
###########
Expand Down Expand Up @@ -352,7 +333,7 @@ spec:
######################################
## Additional environment variables ##
######################################
- name: "EDC_CONNECTOR_NAME"
- name: "EDC_RUNTIME_ID"
value: {{ include "txdc.fullname" .}}-controlplane
{{- range $key, $value := .Values.controlplane.envValueFrom }}
- name: {{ $key | quote }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ spec:
value: {{ .Values.dataplane.endpoints.public.port | quote }}
- name: "WEB_HTTP_PUBLIC_PATH"
value: {{ .Values.dataplane.endpoints.public.path | quote }}
- name: "EDC_CONTROL_ENDPOINT"
value: {{ include "txdc.dataplane.url.control" . }}
- name: "EDC_DATAPLANE_TOKEN_VALIDATION_ENDPOINT"
value: {{ include "txdc.controlplane.url.validation" .}}

Expand Down Expand Up @@ -296,7 +298,7 @@ spec:
######################################
## Additional environment variables ##
######################################
- name: "EDC_CONNECTOR_NAME"
- name: "EDC_RUNTIME_ID"
value: {{ include "txdc.fullname" .}}-dataplane
{{- range $key, $value := .Values.dataplane.envValueFrom }}
- name: {{ $key | quote }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ spec:
targetPort: signaling
protocol: TCP
name: signaling
- port: {{ .Values.dataplane.endpoints.control.port }}
targetPort: control
protocol: TCP
name: control
- port: {{ .Values.dataplane.endpoints.public.port }}
targetPort: public
protocol: TCP
Expand Down
15 changes: 0 additions & 15 deletions charts/tractusx-connector-memory/templates/deployment-runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,21 +236,6 @@ spec:
################
## DATA PLANE ##
################

# see extension https://github.com/eclipse-tractusx/tractusx-edc/tree/develop/edc-extensions/dataplane-selector-configuration
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_URL"
value: {{ include "txdc.dataplane.url.signaling" . }}/v1/dataflows
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_TRANSFERTYPES"
value: "HttpData-PULL,HttpData-PUSH,AmazonS3-PUSH,AzureStorage-PUSH"
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_SOURCETYPES"
value: "HttpData,AmazonS3,AzureStorage"
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_DESTINATIONTYPES"
value: "HttpData,HttpProxy,AmazonS3,AzureStorage"
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_PROPERTIES"
value: |-
{{ printf "{ \"publicApiUrl\": \"%s\" }" (include "txdc.dataplane.url.public" . ) }}
- name: "EDC_DATAPLANE_API_PUBLIC_BASEURL"
value: {{ include "txdc.dataplane.url.public" . }}

Expand Down
9 changes: 8 additions & 1 deletion charts/tractusx-connector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,19 @@ Validation URL
{{- end }}

{{/*
Control Plane URL
Control Plane Control URL
*/}}
{{- define "txdc.controlplane.url.control" -}}
{{- printf "http://%s-controlplane:%v%s" ( include "txdc.fullname" $ ) $.Values.controlplane.endpoints.control.port $.Values.controlplane.endpoints.control.path -}}
{{- end }}

{{/*
Data Plane Control URL
*/}}
{{- define "txdc.dataplane.url.control" -}}
{{- printf "http://%s-dataplane:%v%s" ( include "txdc.fullname" $ ) $.Values.dataplane.endpoints.control.port $.Values.dataplane.endpoints.control.path -}}
{{- end }}

{{/*
Data Signaling URL
*/}}
Expand Down
22 changes: 1 addition & 21 deletions charts/tractusx-connector/templates/deployment-controlplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -299,26 +299,6 @@ spec:
value: {{ .Values.controlplane.bdrs.cache_validity_seconds | quote}}
{{- end}}

################
## DATA PLANE ##
################

# see extension https://github.com/eclipse-tractusx/tractusx-edc/tree/main/edc-extensions/dataplane-selector-configuration
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_URL"
value: {{ include "txdc.dataplane.url.signaling" . }}/v1/dataflows
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_TRANSFERTYPES"
value: "HttpData-PULL,HttpData-PUSH,AmazonS3-PUSH,AzureStorage-PUSH"
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_SOURCETYPES"
value: "HttpData,AmazonS3,AzureStorage"
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_DESTINATIONTYPES"
value: "HttpData,HttpProxy,AmazonS3,AzureStorage"
- name: "EDC_DATAPLANE_SELECTOR_DEFAULTPLANE_PROPERTIES"
value: |-
{{ printf "{ \"publicApiUrl\": \"%s\" }" (include "txdc.dataplane.url.public" . ) }}
###########
## VAULT ##
###########
Expand Down Expand Up @@ -348,7 +328,7 @@ spec:
######################################
## Additional environment variables ##
######################################
- name: "EDC_CONNECTOR_NAME"
- name: "EDC_RUNTIME_ID"
value: {{ include "txdc.fullname" .}}-controlplane
{{- range $key, $value := .Values.controlplane.envValueFrom }}
- name: {{ $key | quote }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ spec:
value: {{ .Values.dataplane.endpoints.public.port | quote }}
- name: "WEB_HTTP_PUBLIC_PATH"
value: {{ .Values.dataplane.endpoints.public.path | quote }}
- name: "EDC_CONTROL_ENDPOINT"
value: {{ include "txdc.dataplane.url.control" . }}
- name: "EDC_DATAPLANE_TOKEN_VALIDATION_ENDPOINT"
value: {{ include "txdc.controlplane.url.validation" .}}

Expand Down Expand Up @@ -291,7 +293,7 @@ spec:
######################################
## Additional environment variables ##
######################################
- name: "EDC_CONNECTOR_NAME"
- name: "EDC_RUNTIME_ID"
value: {{ include "txdc.fullname" .}}-dataplane
{{- range $key, $value := .Values.dataplane.envValueFrom }}
- name: {{ $key | quote }}
Expand Down
4 changes: 4 additions & 0 deletions charts/tractusx-connector/templates/service-dataplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ spec:
targetPort: signaling
protocol: TCP
name: signaling
- port: {{ .Values.dataplane.endpoints.control.port }}
targetPort: control
protocol: TCP
name: control
- port: {{ .Values.dataplane.endpoints.public.port }}
targetPort: public
protocol: TCP
Expand Down
2 changes: 0 additions & 2 deletions edc-controlplane/edc-controlplane-base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ plugins {

dependencies {
runtimeOnly(project(":core:edr-core"))
runtimeOnly(project(":edc-extensions:dataplane:dataplane-selector-configuration"))

runtimeOnly(project(":edc-extensions:provision-additional-headers"))
runtimeOnly(project(":edc-extensions:edr:edr-api-v2"))
runtimeOnly(project(":edc-extensions:edr:edr-callback"))
Expand Down
2 changes: 2 additions & 0 deletions edc-dataplane/edc-dataplane-base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ dependencies {
runtimeOnly(libs.edc.dpf.core)
runtimeOnly(libs.edc.controlplane.apiclient)

runtimeOnly(libs.edc.data.plane.selector.client)
runtimeOnly(libs.edc.data.plane.self.registration)
runtimeOnly(libs.edc.dpf.api.control)
runtimeOnly(libs.edc.dpf.api.signaling)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import static java.lang.String.format;
import static java.lang.String.join;

@Deprecated(since = "0.7.2")
@Requires({ DataPlaneSelectorService.class })
public class DataPlaneSelectorConfigurationServiceExtension implements ServiceExtension {

Expand All @@ -51,7 +52,7 @@ public class DataPlaneSelectorConfigurationServiceExtension implements ServiceEx
public static final String PROPERTIES_SUFFIX = "properties";
public static final String PUBLIC_API_URL_PROPERTY = "publicApiUrl";

private static final String NAME = "Data Plane Selector Configuration Extension";
private static final String NAME = "DEPRECATED: Data Plane Selector Configuration Extension";
private static final String COMMA = ",";
private static final String LOG_MISSING_CONFIGURATION = NAME + ": Missing configuration for " + CONFIG_PREFIX + ".%s.%s";
private static final String LOG_SKIP_BC_MISSING_CONFIGURATION = NAME + ": Configuration issues. Skip registering of Data Plane Instance '%s'";
Expand All @@ -66,12 +67,12 @@ public String name() {
}

@Override
public void initialize(final ServiceExtensionContext serviceExtensionContext) {
this.dataPlaneSelectorService =
serviceExtensionContext.getService(DataPlaneSelectorService.class);
this.monitor = serviceExtensionContext.getMonitor();
public void initialize(ServiceExtensionContext context) {
this.dataPlaneSelectorService = context.getService(DataPlaneSelectorService.class);
this.monitor = context.getMonitor();
monitor.warning("The dataplane-selector-configuration has been deprecated, as now data-planes can register itself through the data-plane-self-registration extension.");

var config = serviceExtensionContext.getConfig(CONFIG_PREFIX);
var config = context.getConfig(CONFIG_PREFIX);

config.partition().forEach(this::configureDataPlaneInstance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.tractusx.edc.dataplane.selector.configuration.DataPlaneSelectorConfigurationServiceExtension.CONFIG_PREFIX;
import static org.eclipse.tractusx.edc.dataplane.selector.configuration.DataPlaneSelectorConfigurationServiceExtension.DESTINATION_TYPES_SUFFIX;
import static org.eclipse.tractusx.edc.dataplane.selector.configuration.DataPlaneSelectorConfigurationServiceExtension.PROPERTIES_SUFFIX;
import static org.eclipse.tractusx.edc.dataplane.selector.configuration.DataPlaneSelectorConfigurationServiceExtension.PUBLIC_API_URL_PROPERTY;
import static org.eclipse.tractusx.edc.dataplane.selector.configuration.DataPlaneSelectorConfigurationServiceExtension.SOURCE_TYPES_SUFFIX;
import static org.eclipse.tractusx.edc.dataplane.selector.configuration.DataPlaneSelectorConfigurationServiceExtension.TRANSFER_TYPES_SUFFIX;
import static org.eclipse.tractusx.edc.dataplane.selector.configuration.DataPlaneSelectorConfigurationServiceExtension.URL_SUFFIX;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.argThat;
Expand Down Expand Up @@ -87,8 +86,7 @@ void setup() {
void testName() {
var extension = new DataPlaneSelectorConfigurationServiceExtension();

assertNotNull(extension.name());
assertEquals("Data Plane Selector Configuration Extension", extension.name());
assertThat(extension.name()).contains("Data Plane Selector Configuration Extension");
}

@Test
Expand Down Expand Up @@ -124,8 +122,8 @@ void testWarningOnPropertyMissing(String configKey, String configValue) {
when(serviceExtensionContext.getConfig(CONFIG_PREFIX)).thenReturn(config);
extension.initialize(serviceExtensionContext);

// one warning config missing, one warning data plane instance skipped
verify(monitor, times(2)).warning(anyString());
// one warning deprecation, one warning config missing, one warning data plane instance skipped
verify(monitor, times(3)).warning(anyString());
}

@Test
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public String getBpn() {
public Map<String, String> getConfiguration() {
return new HashMap<>() {
{
put("edc.connector.name", name);
put("edc.runtime.id", name);
put("edc.participant.id", id);
put("web.http.port", String.valueOf(controlPlaneDefault.getPort()));
put("web.http.path", "/api");
Expand All @@ -103,11 +103,6 @@ public Map<String, String> getConfiguration() {
put("edc.transfer.send.retry.base-delay.ms", "100");
put("tx.dpf.consumer.proxy.port", String.valueOf(dataPlaneProxy.getPort()));
put("edc.dataplane.token.validation.endpoint", controlPlaneControl + "/token");
put("edc.dataplane.selector.httpplane.url", controlPlaneControl.toString());
put("edc.dataplane.selector.httpplane.sourcetypes", "HttpData");
put("edc.dataplane.selector.httpplane.destinationtypes", "HttpProxy");
put("edc.dataplane.selector.httpplane.transfertypes", "HttpProxy-PULL");
put("edc.dataplane.selector.httpplane.properties", "{\"publicApiUrl\":\"http://localhost:" + dataPlanePublic.getPort() + "/api/public/v2\"}");
put("edc.receiver.http.dynamic.endpoint", "http://localhost:" + controlPlaneDefault.getPort() + "/api/consumer/datareference");
put("tractusx.businesspartnervalidation.log.agreement.validation", "true");
put("edc.agent.identity.key", "BusinessPartnerNumber");
Expand Down
Loading

0 comments on commit f3b25c6

Please sign in to comment.