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

feat(impl):[#312] irs local helm setup #789

Merged
merged 4 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
35 changes: 35 additions & 0 deletions local/deployment/irs-local/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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
ds-ext-kmassalski marked this conversation as resolved.
Show resolved Hide resolved
#
# 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
113 changes: 113 additions & 0 deletions local/deployment/irs-local/README.md
Original file line number Diff line number Diff line change
@@ -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"
}
}
```
71 changes: 71 additions & 0 deletions local/deployment/irs-local/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 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
ds-ext-kmassalski marked this conversation as resolved.
Show resolved Hide resolved
#
# 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:
ds-ext-kmassalski marked this conversation as resolved.
Show resolved Hide resolved
#####################
# 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: "500Mi"

#######################
# Minio Configuration #
#######################
minio:
rootUser: "testtest"
rootPassword: "testtest"

#########################
# Grafana Configuration #
#########################
grafana:
enabled: false

############################
# Prometheus Configuration #
############################
prometheus:
enabled: false