From eb40a9f9d763271c15770f93715d82b766416cd2 Mon Sep 17 00:00:00 2001 From: "Krzysztof Massalski (Extern)" Date: Tue, 27 Feb 2024 10:20:35 +0100 Subject: [PATCH 1/4] feat(impl):[#312] irs local helm setup --- local/deployment/irs-local/Chart.yaml | 35 ++++++++ local/deployment/irs-local/README.md | 113 +++++++++++++++++++++++++ local/deployment/irs-local/values.yaml | 50 +++++++++++ 3 files changed, 198 insertions(+) create mode 100644 local/deployment/irs-local/Chart.yaml create mode 100644 local/deployment/irs-local/README.md create mode 100644 local/deployment/irs-local/values.yaml diff --git a/local/deployment/irs-local/Chart.yaml b/local/deployment/irs-local/Chart.yaml new file mode 100644 index 0000000000..41742cf1a6 --- /dev/null +++ b/local/deployment/irs-local/Chart.yaml @@ -0,0 +1,35 @@ +# Copyright (c) 2021,2022,2023 +# 2022: ZF Friedrichshafen AG +# 2022: ISTOS GmbH +# 2022,2023: Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# 2022,2023: BOSCH AG +# Copyright (c) 2021,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 +# +apiVersion: v2 +name: irs-helm-local +description: IRS Helm chart for local Kubernetes +home: https://eclipse-tractusx.github.io/ +sources: + - https://github.com/eclipse-tractusx/item-relationship-service +type: application +version: 6.14.0 +appVersion: "4.5.0" + +dependencies: + - name: irs-helm + repository: https://eclipse-tractusx.github.io/item-relationship-service + version: 6.14.0 diff --git a/local/deployment/irs-local/README.md b/local/deployment/irs-local/README.md new file mode 100644 index 0000000000..20cccbd201 --- /dev/null +++ b/local/deployment/irs-local/README.md @@ -0,0 +1,113 @@ +# Item Relationship Service + +## Local deployment of IRS with minimum dependencies setup + +### Step 1: Prerequisites + +1. [Docker](https://docs.docker.com/get-docker/) is installed and the Docker deamon is running with at least 8GB of memory +2. [helm](https://helm.sh/docs/intro/install/) is installed +3. Any Kubernetes cluster is installed and running, eg. [Minikube](https://minikube.sigs.k8s.io/docs/start/) +4. [kubectl](https://kubernetes.io/docs/tasks/tools/) is installed + +### Step 2: Update and build the irs-helm chart + +```bash +$ helm dependency build +``` +You should see console output with messages like below: +```bash +Hang tight while we grab the latest from your chart repositories... +...Successfully got an update from the "irs" chart repository +...Successfully got an update from the "tractusx-dev" chart repository +...Successfully got an update from the "prometheus-community" chart repository +Update Complete. ⎈Happy Helming!⎈ +Saving 1 charts +Downloading irs-helm from repo https://eclipse-tractusx.github.io/item-relationship-service +Deleting outdated charts +``` +Please note that irs repository has to be added to helm repo list +```bash +$ helm repo add irs https://eclipse-tractusx.github.io/item-relationship-service +$ helm repo list +NAME URL +irs https://eclipse-tractusx.github.io/item-relationship-service +``` + +### Step 3: Installing the IRS + +#### 1. Start the cluster + +To deploy IRS on kubernetes with helm run + +```bash +$ helm install irs-local . +``` + +##### 1.1 Get the Status of the deployment + +Helm can give you feedback on the release status: + +```bash +$ helm list +NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION +irs-local default 1 2024-02-26 11:36:46.399546 +0100 CET deployed irs-helm-local-6.14.0 4.5.0 +``` +Kubectl can give you feedback on how the status of the deployment currently is, there should be two pods deployed - IRS and Minio: +```bash +$ kubectl get pods +NAME READY STATUS RESTARTS AGE +irs-local-minio-7cc78d8985-qggrx 1/1 Running 0 10m +irs-local-irs-helm-c84f98ffb-zg59z 1/1 Running 0 10m + +``` + +#### 2. Forward Ports + +When the deployment has been finished please use the command to forward the port: + +```bash +$ kubectl port-forward svc/irs-local-irs-helm 8080:8080 +``` + +After that you can access the Swagger UI page: + +* **IRS Swagger:** [http://localhost:8080/api/swagger-ui/index.html](http://localhost:8080/api/swagger-ui/index.html) + +## Testing the Item Relationship Service + +You can use any approach to access exposed by IRS API endpoints, for example mentioned above Swagger UI page. There is also prepared Insomnia collection with example calls to IRS, see [IRS_Request_Collection.json](../../testing/IRS_Request_Collection.json) + +### Valid Global Asset Ids for testing + +IRS is loading with mocked data from Testdata file, see [CX_Testdata.json](../../../irs-models/src/main/resources/test_data/CX_Testdata.json) + +### Valid test requests for testing + +You can use these snippets for testing purposes. + +```json +{ + "bomLifecycle": "asBuilt", + "lookupBPNs": true, + "direction": "downward", + "depth": 10, + "auditContractNegotiation": false, + "key": { + "globalAssetId": "urn:uuid:951f1ebf-ebcf-427c-8a4d-7fe1f67c8d58", + "bpn": "BPNL00000003B0Q0" + } +} +```` + +```json +{ + "aspects": [ + "SerialPart" + ], + "depth": 1, + "key": { + "globalAssetId": "urn:uuid:951f1ebf-ebcf-427c-8a4d-7fe1f67c8d58", + "bpn": "BPNL00000003B0Q0" + } +} +``` \ No newline at end of file diff --git a/local/deployment/irs-local/values.yaml b/local/deployment/irs-local/values.yaml new file mode 100644 index 0000000000..0e2b74461c --- /dev/null +++ b/local/deployment/irs-local/values.yaml @@ -0,0 +1,50 @@ +irs-helm: + ##################### + # IRS Configuration # + ##################### + irsUrl: "http://localhost:8080" + bpn: "BPNL000000000000" + apiKeyAdmin: "01234567890123456789" + apiKeyRegular: "09876543210987654321" + env: + - name: SPRING_PROFILES_ACTIVE + value: local + + digitalTwinRegistry: + type: central + discovery: + discoveryFinderUrl: https://localhost + semanticshub: + url: https://localhost + bpdm: + url: https://localhost + + minioUser: "testtest" + minioPassword: "testtest" + + resources: + limits: + cpu: "1000m" + memory: "500Mi" + requests: + cpu: "50m" + memory: "100Mi" + + ####################### + # Minio Configuration # + ####################### + minio: + rootUser: "testtest" + rootPassword: "testtest" + + ######################### + # Grafana Configuration # + ######################### + grafana: + enabled: false + + ############################ + # Prometheus Configuration # + ############################ + prometheus: + enabled: false From 728bb77d5f75e8923041c8d2f97c2b9b73dec0bd Mon Sep 17 00:00:00 2001 From: "Krzysztof Massalski (Extern)" Date: Tue, 27 Feb 2024 13:07:24 +0100 Subject: [PATCH 2/4] feat(impl):[#312] fix review comments --- local/deployment/irs-local/Chart.yaml | 8 ++++---- local/deployment/irs-local/values.yaml | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/local/deployment/irs-local/Chart.yaml b/local/deployment/irs-local/Chart.yaml index 41742cf1a6..c6992876b6 100644 --- a/local/deployment/irs-local/Chart.yaml +++ b/local/deployment/irs-local/Chart.yaml @@ -1,9 +1,9 @@ -# Copyright (c) 2021,2022,2023 +# Copyright (c) 2022,2024 # 2022: ZF Friedrichshafen AG # 2022: ISTOS GmbH -# 2022,2023: Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# 2022,2024: Bayerische Motoren Werke Aktiengesellschaft (BMW AG) # 2022,2023: BOSCH AG -# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation +# Copyright (c) 2021,2024 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -18,7 +18,7 @@ # under the License. # # SPDX-License-Identifier: Apache-2.0 -# + apiVersion: v2 name: irs-helm-local description: IRS Helm chart for local Kubernetes diff --git a/local/deployment/irs-local/values.yaml b/local/deployment/irs-local/values.yaml index 0e2b74461c..c78e7b77df 100644 --- a/local/deployment/irs-local/values.yaml +++ b/local/deployment/irs-local/values.yaml @@ -1,3 +1,24 @@ +# Copyright (c) 2022,2024 +# 2022: ZF Friedrichshafen AG +# 2022: ISTOS GmbH +# 2022,2024: Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# 2022,2023: BOSCH AG +# Copyright (c) 2021,2024 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 + irs-helm: ##################### # IRS Configuration # @@ -28,7 +49,7 @@ irs-helm: memory: "500Mi" requests: cpu: "50m" - memory: "100Mi" + memory: "500Mi" ####################### # Minio Configuration # From a5e939a28f96701df97293ab644cb0c8528207b0 Mon Sep 17 00:00:00 2001 From: "Krzysztof Massalski (Extern)" Date: Tue, 27 Feb 2024 14:44:57 +0100 Subject: [PATCH 3/4] feat(impl):[#312] update copyright --- Dockerfile | 6 +----- local/deployment/irs-local/Chart.yaml | 6 +----- local/deployment/irs-local/values.yaml | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad62273994..a6f0be30ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,4 @@ -# Copyright (c) 2022,2024 -# 2022: ZF Friedrichshafen AG -# 2022: ISTOS GmbH -# 2022,2024: Bayerische Motoren Werke Aktiengesellschaft (BMW AG) -# 2022,2023: BOSCH AG +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) # Copyright (c) 2021,2024 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional diff --git a/local/deployment/irs-local/Chart.yaml b/local/deployment/irs-local/Chart.yaml index c6992876b6..cd18449143 100644 --- a/local/deployment/irs-local/Chart.yaml +++ b/local/deployment/irs-local/Chart.yaml @@ -1,8 +1,4 @@ -# Copyright (c) 2022,2024 -# 2022: ZF Friedrichshafen AG -# 2022: ISTOS GmbH -# 2022,2024: Bayerische Motoren Werke Aktiengesellschaft (BMW AG) -# 2022,2023: BOSCH AG +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) # Copyright (c) 2021,2024 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional diff --git a/local/deployment/irs-local/values.yaml b/local/deployment/irs-local/values.yaml index c78e7b77df..1efcafc82f 100644 --- a/local/deployment/irs-local/values.yaml +++ b/local/deployment/irs-local/values.yaml @@ -1,8 +1,4 @@ -# Copyright (c) 2022,2024 -# 2022: ZF Friedrichshafen AG -# 2022: ISTOS GmbH -# 2022,2024: Bayerische Motoren Werke Aktiengesellschaft (BMW AG) -# 2022,2023: BOSCH AG +# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) # Copyright (c) 2021,2024 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional From 1811f32ad04d0f8dfbf99797458cd54f286a12ab Mon Sep 17 00:00:00 2001 From: "Krzysztof Massalski (Extern)" Date: Tue, 27 Feb 2024 14:57:36 +0100 Subject: [PATCH 4/4] feat(impl):[#312] update copyright --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a6f0be30ea..ad62273994 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,8 @@ -# Copyright (c) 2022,2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2022,2024 +# 2022: ZF Friedrichshafen AG +# 2022: ISTOS GmbH +# 2022,2024: Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# 2022,2023: BOSCH AG # Copyright (c) 2021,2024 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional