Skip to content

Commit

Permalink
Merge pull request #55 from catenax-ng/main
Browse files Browse the repository at this point in the history
sync code with main branch
  • Loading branch information
sachinargade123 authored Mar 20, 2023
2 parents bd938de + 6d52c6d commit f3cea28
Show file tree
Hide file tree
Showing 20 changed files with 179 additions and 179 deletions.
17 changes: 10 additions & 7 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
### The following people have contributed to this repository
# Authors

Aditya Kumar, doubleSlash Net-Business GmbH, https://github.com/adkumar1 <br />
Aditya Gajbhiye, doubleSlash Net-Business GmbH, https://github.com/adityagajbhiye <br />
Sachin Argade, doubleSlash Net-Business GmbH, https://github.com/sachinargade123 <br />
Dmitrii Vasiunin, doubleSlash Net-Business GmbH, https://github.com/dvasunin <br />
Amol Dashwant, doubleSlash Net-Business GmbH, https://github.com/amoldashwant <br />
Fedor Nazarov, doubleSlash Net-Business GmbH, https://github.com/Wulghash <br />
The following people have contributed to this repository:

* Sachin Argade, T-Systems International GmbH, https://github.com/sachinargade123
* Chetan Parate, T-Systems International GmbH, https://github.com/ChetanT-System
* Aditya Gajbhiye, T-Systems International GmbH, https://github.com/adityagajbhiye
* Aditya Kumar, T-Systems International GmbH, https://github.com/adkumar1
* Dmitrii Vasiunin, T-Systems International GmbH, https://github.com/dvasunin
* Amol Dashwant, T-Systems International GmbH, https://github.com/amoldashwant
* Fedor Nazarov,, T-Systems International GmbH, https://github.com/Wulghash
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [1.2.1] - 2023-03-18

### Fixed
- Sonar code duplication issue fix

## [1.2.0] - 2023-03-14

Expand Down
10 changes: 0 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#*******************************************************************************

# our base build image
#FROM maven:3.8-openjdk-18 as builder
FROM maven:3.9.0-eclipse-temurin-19 as builder

# copy the project files
Expand All @@ -34,10 +33,6 @@ COPY ./src ./src
# build for release
RUN mvn clean install -Dmaven.test.skip=true

# our final base image
#FROM eclipse-temurin:18.0.1_10-jre

#FROM eclipse-temurin:19_36-jre

FROM eclipse-temurin:latest

Expand All @@ -48,12 +43,7 @@ ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
# && apt-get update \
# && apt-get install -y sudo \
# && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
# && chmod 0440 /etc/sudoers.d/$USERNAME

# set deployment directory
WORKDIR /autosetup

# copy over the built artifact from the maven image
Expand Down
6 changes: 3 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Helm charts are provided inside https://github.com/eclipse-tractusx/autosetup-ba

- Using helm commands <br />

How to install application using helm:- <br />
How to install application using helm: <br />
helm install ReleaseName ChartName

a.) Add helm repository in tractusx:-
a.) Add helm repository in tractusx:
helm repo add autosetup https://eclipse-tractusx.github.io/charts/dev
b.) To search the specific repo in helm repositories
helm search repo tractusx-dev
c.) To install using helm command:-
c.) To install using helm command:
helm install autosetup tractusx-dev/autosetup

6 changes: 3 additions & 3 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.0
Helm release version: 1.2.0
Application version: 1.2.1
Helm release version: 1.2.1
```


Expand All @@ -40,7 +40,7 @@ You can find the standard credentials as well as further database configurations

### Steps
1. Clone the GitHub Repository - https://github.com/eclipse-tractusx/autosetup-backend
2. Get your instance of postgres running.
2. Get your instance of postgres running
3. Setup your project environment to JDK 18
4. Start the application from your IDE.

Expand Down
23 changes: 0 additions & 23 deletions charts/.helmignore

This file was deleted.

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.0
version: 1.2.1


# 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.0"
appVersion: "1.2.1"
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.0](https://img.shields.io/badge/Version-1.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.2.0](https://img.shields.io/badge/AppVersion-1.2.0-informational?style=flat-square)
![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)

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.0</version>
<version>1.2.1</version>
<name>auto-setup</name>
<description>auto-setup</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/********************************************************************************
#* Copyright (c) 2022, 2023 T-Systems International GmbH
#* Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation
#*
#* See the NOTICE file(s) distributed with this work for additional
#* information regarding copyright ownership.
#*
#* This program and the accompanying materials are made available under the
#* terms of the Apache License, Version 2.0 which is available at
#* https://www.apache.org/licenses/LICENSE-2.0.
#*
#* Unless required by applicable law or agreed to in writing, software
#* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#* License for the specific language governing permissions and limitations
#* under the License.
#*
#* SPDX-License-Identifier: Apache-2.0
#********************************************************************************/

package org.eclipse.tractusx.autosetup.constant;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import lombok.Getter;

@Getter
@Component
public class DAPsConfigurationProperty {

@Value("${daps.url}")
private String url;

@Value("${daps.jskurl}")
private String jskUrl;

@Value("${daps.token.url}")
private String tokenUrl;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#* SPDX-License-Identifier: Apache-2.0
#********************************************************************************/

package org.eclipse.tractusx.autosetup.manager;
package org.eclipse.tractusx.autosetup.constant;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public String buildConfiguration(AppDetails appDetails, Map<String, String> inpu
String sb=stringSubstitutor1.replace(appDetails.getExpectedInputData());
dyanamicYamlValues.put("yamlValues", sb);
dyanamicYamlValues.put("dnsName", inputProperties.get("dnsName"));
dyanamicYamlValues.putAll(inputProperties);


// Initialize StringSubstitutor instance with value map
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/********************************************************************************
* Copyright (c) 2023 T-Systems International GmbH
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

package org.eclipse.tractusx.autosetup.manager;

import java.util.Map;

import org.eclipse.tractusx.autosetup.constant.DAPsConfigurationProperty;
import org.eclipse.tractusx.autosetup.utility.PasswordGenerator;
import org.springframework.stereotype.Component;

import lombok.RequiredArgsConstructor;

@Component
@RequiredArgsConstructor
public class ConnectorCommonUtilityManager {


private final DAPsConfigurationProperty dAPsConfigurationProperty;

public Map<String, String> prepareConnectorInput(String packageName, Map<String, String> inputData) {

String generateRandomPassword = PasswordGenerator.generateRandomPassword(50);
String dnsName = inputData.get("dnsName");
String dnsNameURLProtocol = inputData.get("dnsNameURLProtocol");

String controlplaneurl = dnsNameURLProtocol + "://" + dnsName;

inputData.put("dapsurl", dAPsConfigurationProperty.getUrl());
inputData.put("dapsjsksurl", dAPsConfigurationProperty.getJskUrl());
inputData.put("dapstokenurl", dAPsConfigurationProperty.getTokenUrl());

inputData.put("dataPlanePublicUrl",
dnsNameURLProtocol + "://" + packageName + "-edcdataplane-edc-dataplane:8185/api/public");

String localControlplane = dnsNameURLProtocol + "://" + packageName
+ "-edccontrolplane-edc-controlplane:8182/validation/token";

inputData.put("controlPlaneValidationEndpoint", localControlplane);

inputData.put("controlPlaneEndpoint", controlplaneurl);
inputData.put("controlPlaneDataEndpoint", controlplaneurl + "/data");
inputData.put("edcApiKey", "X-Api-Key");
inputData.put("edcApiKeyValue", generateRandomPassword);
inputData.put("controlPlaneIdsEndpoint", controlplaneurl + "/api/v1/ids/data");
inputData.put("dataplaneendpoint", controlplaneurl);
inputData.put("dataPlanePublicEndpoint", controlplaneurl + "/public");

String dftAddress = dnsNameURLProtocol + "://" + dnsName + "/dftbackend/api";
inputData.put("dftAddress", dftAddress);

String edcDb = "jdbc:postgresql://" + packageName + "-postgresdb-postgresql:5432/postgres";
inputData.put("edcdatabaseurl", edcDb);

return inputData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.UUID;

import org.eclipse.tractusx.autosetup.constant.AppActions;
import org.eclipse.tractusx.autosetup.constant.SDEConfigurationProperty;
import org.eclipse.tractusx.autosetup.constant.TriggerStatusEnum;
import org.eclipse.tractusx.autosetup.entity.AutoSetupTriggerDetails;
import org.eclipse.tractusx.autosetup.entity.AutoSetupTriggerEntry;
Expand Down Expand Up @@ -100,9 +101,6 @@ public Map<String, String> managePackage(Customer customerDetails, AppActions ac

String packageName = tool.getLabel();

String dftDb = "jdbc:postgresql://" + packageName + "-postgresdb-postgresql:5432/postgres";
inputData.put("dftdatabaseurl", dftDb);

if (AppActions.CREATE.equals(action))
appManagement.createPackage(DFT_BACKEND, packageName, inputData);
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
import org.eclipse.tractusx.autosetup.exception.ServiceException;
import org.eclipse.tractusx.autosetup.model.Customer;
import org.eclipse.tractusx.autosetup.model.SelectedTools;
import org.eclipse.tractusx.autosetup.utility.PasswordGenerator;
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;
Expand All @@ -50,15 +48,7 @@ public class EDCControlplaneManager {

private final KubeAppsPackageManagement appManagement;
private final AutoSetupTriggerManager autoSetupTriggerManager;

@Value("${daps.url}")
private String dapsurl;

@Value("${daps.jskurl}")
private String dapsjsksurl;

@Value("${daps.token.url}")
private String dapstokenurl;
private final ConnectorCommonUtilityManager connectorCommonUtilityManager;

@Retryable(value = {
ServiceException.class }, maxAttemptsExpression = "${retry.maxAttempts}", backoff = @Backoff(delayExpression = "${retry.backOffDelay}"))
Expand All @@ -67,42 +57,11 @@ public Map<String, String> managePackage(Customer customerDetails, AppActions ac

Map<String, String> outputData = new HashMap<>();
AutoSetupTriggerDetails autoSetupTriggerDetails = AutoSetupTriggerDetails.builder()
.id(UUID.randomUUID().toString()).step(EDC_CONTROLPLANE.name())
.build();
.id(UUID.randomUUID().toString()).step(EDC_CONTROLPLANE.name()).build();
try {
String packageName = tool.getLabel();

String generateRandomPassword = PasswordGenerator.generateRandomPassword(50);
String dnsName = inputData.get("dnsName");
String dnsNameURLProtocol = inputData.get("dnsNameURLProtocol");

String controlplaneurl = dnsNameURLProtocol + "://" + dnsName;

inputData.put("dapsurl", dapsurl);
inputData.put("dapsjsksurl", dapsjsksurl);
inputData.put("dapstokenurl", dapstokenurl);

inputData.put("dataPlanePublicUrl",
dnsNameURLProtocol + "://" + packageName + "-edcdataplane-edc-dataplane:8185/api/public");

String localControlplane = dnsNameURLProtocol + "://" + packageName
+ "-edccontrolplane-edc-controlplane:8182/validation/token";

outputData.put("controlPlaneValidationEndpoint", localControlplane);

outputData.put("controlPlaneEndpoint", controlplaneurl);
outputData.put("controlPlaneDataEndpoint", controlplaneurl + "/data");
outputData.put("edcApiKey", "X-Api-Key");
outputData.put("edcApiKeyValue", generateRandomPassword);
outputData.put("controlPlaneIdsEndpoint", controlplaneurl + "/api/v1/ids/data");

inputData.putAll(outputData);

String dftAddress = dnsNameURLProtocol + "://" + dnsName + "/dftbackend/api";
inputData.put("dftAddress", dftAddress);

String edcDb = "jdbc:postgresql://" + packageName + "-postgresdb-postgresql:5432/postgres";
inputData.put("edcdatabaseurl", edcDb);
outputData = connectorCommonUtilityManager.prepareConnectorInput(packageName, inputData);

if (AppActions.CREATE.equals(action))
appManagement.createPackage(EDC_CONTROLPLANE, packageName, inputData);
Expand Down
Loading

0 comments on commit f3cea28

Please sign in to comment.