Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.2.2 #20

Merged
merged 21 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]
- NA

## [1.2.2] - 2023-03-30

### Added
- Connector test service integration for managed connector connectivity test
- Update email template for connector status

## [1.2.1] - 2023-03-18

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ This service will help service provider to set up DFT/SDE with EDC and EDC as se
### Software Version

```shell
Application version: 1.2.1
Helm release version: 1.2.1
Application version: 1.2.2
Helm release version: 1.2.2
```


Expand Down
4 changes: 2 additions & 2 deletions charts/orchestrator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ sources:
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.2.1
version: 1.2.2


# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.2.1"
appVersion: "1.2.2"
dependencies:
- condition: postgresql.enabled
name: postgresql
Expand Down
2 changes: 1 addition & 1 deletion charts/orchestrator/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# autosetup

![Version: 1.2.1](https://img.shields.io/badge/Version-1.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.2.1](https://img.shields.io/badge/AppVersion-1.2.1-informational?style=flat-square)
![Version: 1.2.2](https://img.shields.io/badge/Version-1.2.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.2.2](https://img.shields.io/badge/AppVersion-1.2.2-informational?style=flat-square)

This service will help service provider to set up DFT/SDE with EDC and EDC as service in service provider environment.

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>org.eclipse.tractusx</groupId>
<artifactId>auto-setup</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
<name>auto-setup</name>
<description>auto-setup</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public enum AppNameConstant {

DFT_FRONTEND,

DFT_BACKEND


DFT_BACKEND,

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package org.eclipse.tractusx.autosetup.manager;
Siegfriedk marked this conversation as resolved.
Show resolved Hide resolved

import java.util.Map;
import java.util.UUID;

import org.eclipse.tractusx.autosetup.constant.TriggerStatusEnum;
import org.eclipse.tractusx.autosetup.entity.AutoSetupTriggerDetails;
import org.eclipse.tractusx.autosetup.entity.AutoSetupTriggerEntry;
import org.eclipse.tractusx.autosetup.exception.ServiceException;
import org.eclipse.tractusx.autosetup.model.Customer;
import org.eclipse.tractusx.autosetup.testservice.proxy.ConnectorTestRequest;
import org.eclipse.tractusx.autosetup.testservice.proxy.ConnectorTestServiceProxy;
import org.eclipse.tractusx.autosetup.testservice.proxy.ConnectorTestServiceResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.retry.support.RetrySynchronizationManager;
import org.springframework.stereotype.Service;

import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

@Service
@Slf4j
@RequiredArgsConstructor
public class TestConnectorServiceManager {

private final AutoSetupTriggerManager autoSetupTriggerManager;

private final ConnectorTestServiceProxy connectorTestServiceProxy;

@Value("${connector.test.service.url}")
private String connectorTestServiceURL;

@Retryable(value = {
ServiceException.class }, maxAttemptsExpression = "${retry.maxAttempts}", backoff = @Backoff(delayExpression = "${retry.backOffDelay}"))
public Map<String, String> verifyConnectorTestingThroughTestService(Customer customerDetails,
Map<String, String> inputData, AutoSetupTriggerEntry triger) {

AutoSetupTriggerDetails autoSetupTriggerDetails = AutoSetupTriggerDetails.builder()
.id(UUID.randomUUID().toString()).step("CONNECTOR_TEST_SERVICE").build();
try {

ConnectorTestRequest connectorTestRequest = ConnectorTestRequest.builder()
.apiKeyHeader(inputData.get("edcApiKey")).apiKeyValue(inputData.get("edcApiKeyValue"))
.connectorHost(inputData.get("controlPlaneEndpoint")).build();

inputData.put("testServiceURL", connectorTestServiceURL);

waitingTime();

ConnectorTestServiceResponse testResult = connectorTestServiceProxy
.verifyConnectorTestingThroughTestService(connectorTestRequest);

log.info("Connector status: " + testResult.getMessage());

inputData.put("connectorTestResult", testResult.getMessage());

autoSetupTriggerDetails.setStatus(TriggerStatusEnum.SUCCESS.name());

} catch (Exception ex) {

inputData.put("connectorTestResult", "The automatic test wasn't successfully completed");

log.error("ConnectorTestService failed retry attempt: : {}",
RetrySynchronizationManager.getContext().getRetryCount() + 1);

autoSetupTriggerDetails.setStatus(TriggerStatusEnum.FAILED.name());
autoSetupTriggerDetails.setRemark(ex.getMessage());
throw new ServiceException("ConnectorTestService Oops! We have an exception - " + ex.getMessage());
} finally {
autoSetupTriggerManager.saveTriggerDetails(autoSetupTriggerDetails, triger);
}

return inputData;
}

@SneakyThrows
private void waitingTime() {

try {
log.info("Waiting after connector setup to get pod up to test connector as data provider/consumer");
Thread.sleep(60000);
} catch (InterruptedException e) {

Thread.currentThread().interrupt();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,33 @@

import static org.eclipse.tractusx.autosetup.constant.AppNameConstant.EDC_CONTROLPLANE;
import static org.eclipse.tractusx.autosetup.constant.AppNameConstant.EDC_DATAPLANE;
import static org.eclipse.tractusx.autosetup.constant.AppNameConstant.TRACTUS_CONNECTOR;
import static org.eclipse.tractusx.autosetup.constant.AppNameConstant.POSTGRES_DB;
import static org.eclipse.tractusx.autosetup.constant.AppNameConstant.TRACTUS_CONNECTOR;

import java.util.Map;

import org.eclipse.tractusx.autosetup.constant.AppActions;
import org.eclipse.tractusx.autosetup.entity.AutoSetupTriggerEntry;
import org.eclipse.tractusx.autosetup.exception.ServiceException;
import org.eclipse.tractusx.autosetup.manager.AppDeleteManager;
import org.eclipse.tractusx.autosetup.manager.CertificateManager;
import org.eclipse.tractusx.autosetup.manager.ConnectorRegistrationManager;
import org.eclipse.tractusx.autosetup.manager.EDCControlplaneManager;
import org.eclipse.tractusx.autosetup.manager.EDCDataplaneManager;
import org.eclipse.tractusx.autosetup.manager.PostgresDBManager;
import org.eclipse.tractusx.autosetup.manager.TestConnectorServiceManager;
import org.eclipse.tractusx.autosetup.manager.TractusConnectorManager;
import org.eclipse.tractusx.autosetup.manager.VaultManager;
import org.eclipse.tractusx.autosetup.model.Customer;
import org.eclipse.tractusx.autosetup.model.SelectedTools;
import org.springframework.stereotype.Component;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Component
@RequiredArgsConstructor
@Slf4j
public class EDCConnectorWorkFlow {

private final CertificateManager certificateManager;
Expand All @@ -54,6 +58,7 @@ public class EDCConnectorWorkFlow {
private final EDCDataplaneManager edcDataplaneManager;
private final TractusConnectorManager tractusConnectorManager;
private final ConnectorRegistrationManager connectorRegistrationManager;
private final TestConnectorServiceManager testConnectorServiceManager;

private final AppDeleteManager appDeleteManager;

Expand All @@ -70,6 +75,13 @@ public Map<String, String> getWorkFlow(Customer customerDetails, SelectedTools t
inputConfiguration.putAll(
connectorRegistrationManager.registerConnector(customerDetails, tool, inputConfiguration, triger));

try {
inputConfiguration.putAll(testConnectorServiceManager
.verifyConnectorTestingThroughTestService(customerDetails, inputConfiguration, triger));
} catch (ServiceException ex) {
log.warn(ex.getMessage());
}

return inputConfiguration;
}

Expand All @@ -95,6 +107,13 @@ public Map<String, String> getWorkFlowSeparateCPandDP(Customer customerDetails,
inputConfiguration.putAll(
connectorRegistrationManager.registerConnector(customerDetails, tool, inputConfiguration, triger));

try {
inputConfiguration.putAll(testConnectorServiceManager
.verifyConnectorTestingThroughTestService(customerDetails, inputConfiguration, triger));
} catch (ServiceException ex) {
log.warn(ex.getMessage());
}

return inputConfiguration;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.eclipse.tractusx.autosetup.testservice.proxy;

import lombok.Builder;
import lombok.Data;
Siegfriedk marked this conversation as resolved.
Show resolved Hide resolved

@Data
@Builder
public class ConnectorTestRequest {

private String connectorHost;

private String apiKeyHeader;

private String apiKeyValue;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.eclipse.tractusx.autosetup.testservice.proxy;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "ConnectorTestServiceProxy", url = "${connector.test.service.url}")
public interface ConnectorTestServiceProxy {

@PostMapping("/connector-test")
public ConnectorTestServiceResponse verifyConnectorTestingThroughTestService(@RequestBody ConnectorTestRequest connectorTestRequest);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.eclipse.tractusx.autosetup.testservice.proxy;

import lombok.Data;

@Data
public class ConnectorTestServiceResponse {

private String message;

}
2 changes: 2 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ vault.url=${vaultUrl}
vault.token=${vaultToken}
vault.timeout=30

#Connector Test service details
Siegfriedk marked this conversation as resolved.
Show resolved Hide resolved
connector.test.service.url=${connectorTestServiceUrl}

#Portal interface info
portal.url=${portalurl}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/flyway/V1__auto-setup-table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ connector.discovery.token-url=$\{sde.connector.discovery.token-url\}

connector.discovery.clientId=$\{sde.connector.discovery.clientId\}

connector.discovery.clientSecret=$\{sde.connector.discovery.clientSecret\}', NULL, 'sde-backend/dftbackend', '1.9.0', 'helm.packages', 'v1alpha1', '{"dftpostgresql": {"enabled": true, "auth" : {"secretKeys":{"password":"$\{postgresPassword}"\},"username":"$\{username\}","database":"$\{database\}"}},"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftbackend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
connector.discovery.clientSecret=$\{sde.connector.discovery.clientSecret\}', NULL, 'sde-backend/dftbackend', '2.0.0', 'helm.packages', 'v1alpha1', '{"dftpostgresql": {"enabled": true, "primary":{"persistence":{"size" :"1Gi"}},"persistence":{"size" :"1Gi"}, "auth" : {"secretKeys":{"password":"$\{postgresPassword}"\},"username":"$\{username\}","database":"$\{database\}"}},"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftbackend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
INSERT INTO app_tbl
(app_name, context_cluster, context_namespace, expected_input_data, output_data, package_identifier, package_version, plugin_name, plugin_version, required_yaml_configuration, yaml_value_field_type)
VALUES('DFT_FRONTEND', 'default', 'kubeapps', 'REACT_APP_API_URL=$\{dftBackEndUrl\}
Expand All @@ -125,7 +125,7 @@ REACT_APP_CLIENT_ID=$\{dftfrontendkeycloakclientid\}

REACT_APP_DEFAULT_COMPANY_BPN=$\{bpnNumber\}

REACT_APP_FILESIZE=268435456', NULL, 'sde-frontend/dftfrontend', '1.9.0', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftfrontend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
REACT_APP_FILESIZE=268435456', NULL, 'sde-frontend/dftfrontend', '2.0.0', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftfrontend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
INSERT INTO app_tbl
(app_name, context_cluster, context_namespace, expected_input_data, output_data, package_identifier, package_version, plugin_name, plugin_version, required_yaml_configuration, yaml_value_field_type)
VALUES('EDC_CONTROLPLANE', 'default', 'kubeapps', 'edc.receiver.http.endpoint=$\{dftAddress\}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/templates/edc_success_activate.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
<p>EDC ApiKey : <a href="#">${edcApiKey}</a>
<p>EDC ApiKeyValue : <a href="#">${edcApiKeyValue}</a>
<p>Data Plane URL : <a href="#">${dataPlanePublicEndpoint}</a>

<p>Your connector status through connector test service: ${connectorTestResult}, check status again <a href="${testServiceURL}">here</a></p>

<p>Kind Regards<br />Catina-X</p>

</div>
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/templates/success_activate.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<p><strong>Hello ${orgname},</strong></p>
<p>The SDE/DFT tool successfully activated for your use.</p>
<p>Please click <a href="${dftFrontEndUrl}">here</a> to start using it.</p>
<p>Your connector status through connector test service: ${connectorTestResult}, check status again <a href="${testServiceURL}">here</a></p>
<p>Note: You need to use your own organization login credential to login SDE/DFT tool.</p>

<p>Kind Regards<br />Catina-X</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void managePackage() {
mockInputMap.put("dnsNameURLProtocol", "https");
Map<String, String> resultMap = dftBackendManager.managePackage(null, AppActions.CREATE, selectedTools,
mockInputMap, null);
assertEquals(18, resultMap.size());
assertEquals(17, resultMap.size());
assertEquals("test", mockInputMap.get("dnsName"));
}
}
2 changes: 2 additions & 0 deletions src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ vault.url=test
vault.token=test
vault.timeout=30

#Connector Test service details
connector.test.service.url=test

#Portal interface info
portal.url=test
Expand Down