Skip to content

Commit

Permalink
Merge pull request #308 from catenax-ng/release/v3.0.0-single-api
Browse files Browse the repository at this point in the history
feat(single-api): single api functionality
  • Loading branch information
matbmoser authored May 10, 2024
2 parents d9e97d4 + beafc44 commit 04a7f94
Show file tree
Hide file tree
Showing 33 changed files with 1,567 additions and 728 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ tgz
## Backup Files
*.bck
*.bak
bin

######## Python - inspired by https://github.com/github/gitignore/blob/main/Python.gitignore

Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,24 @@

The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [Unreleased]

## [released]
## [v2.3.0] - 06-05-2024
### Added
- SingleApiRequest class for the requested data for the single API.
- SingleApiConfig class to had configurations related to the single API.
- ContractService class to move all the processing logic from the API and Contract controllers to this service.
- Added the following Industry Core changes to the policy and digital twin:
- Added `manufacturerId` and `digitalTwinType` to the specificAssetIds in digital twin registry
- Added localIdentifiers to the SerialPart aspect model
- Updated ApiController with the singleApi POST method.
- Updated ContractController by creating call methods (create, search, agree and status) without the authentication step to call in the Single API.
- Updated AuthenticationService by adding the isSingleApiAuthenticated method to authenticate the single API key.
- Updated application.yaml with the single api configurations.
- Updated deployment-backend.yaml with the oauth.apiKey.
- Updated values-int/beta/dev.yaml files with the oauth.apiKey.

### Updated
- Refactored workflows where required
Expand All @@ -45,6 +55,12 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e
- Updated documentation references where required
- Updated infrastructure guide
- Updated testdata script to allow EDC constrained policy for the registry
- Updated ApiController with the singleApi POST method.
- Updated ContractController by creating call methods (create, search, agree and status) without the authentication step to call in the Single API.
- Updated AuthenticationService by adding the isSingleApiAuthenticated method to authenticate the single API key.
- Updated application.yaml with the single api configurations.
- Updated deployment-backend.yaml with the oauth.apiKey.
- Updated values-int/beta/dev.yaml files with the oauth.apiKey.
- Refactored the swagger workflow
- Updated: as agreed removed BASF from the license and license headers and added CGI instead

Expand Down
124 changes: 62 additions & 62 deletions DEPENDENCIES_BACKEND

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion charts/digital-product-pass/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type: application
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)

version: 2.3.1
version: 2.3.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
Expand Down
6 changes: 6 additions & 0 deletions charts/digital-product-pass/templates/configmap-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ data:
startUpChecks:
bpnCheck: {{ .Values.backend.securityCheck.bpn }}
edcCheck: {{ .Values.backend.securityCheck.edc }}
authentication:
header: {{ .Values.oauth.apiKey.header }}
# -- irs configuration
irs:
enabled: {{ .Values.backend.irs.enabled }} # -- Enable search for children in the requests
Expand Down Expand Up @@ -123,6 +125,10 @@ data:
# -- edc discovery configuration
edc:
key: {{ tpl (.Values.backend.discovery.edcDiscovery.key | default "bpn") . | quote }}
# -- configuration to the single API endpoint
single-api:
maxRetries: {{ .Values.backend.singleApi.maxRetries }}
delay: {{ .Values.backend.singleApi.delay }}
# -- process configuration
process:
# -- directory for storing the contract negotiation files
Expand Down
16 changes: 10 additions & 6 deletions charts/digital-product-pass/templates/deployment-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,32 @@ spec:
valueFrom:
secretKeyRef:
key: appId
name: {{ .Release.Name }}-avp-consumer-backend-auth
name: {{ .Release.Name }}-backend-auth
- name: "client.id"
valueFrom:
secretKeyRef:
key: clientId
name: {{ .Release.Name }}-avp-consumer-backend-auth
name: {{ .Release.Name }}-backend-auth
- name: "client.secret"
valueFrom:
secretKeyRef:
key: clientSecret
name: {{ .Release.Name }}-avp-consumer-backend-auth
name: {{ .Release.Name }}-backend-auth
- name: "edc.apiKey"
valueFrom:
secretKeyRef:
key: xApiKey
name: {{ .Release.Name }}-avp-consumer-backend-edc-oauth
name: {{ .Release.Name }}-backend-edc-oauth
- name: "edc.participantId"
valueFrom:
secretKeyRef:
key: participantId
name: {{ .Release.Name }}-avp-consumer-backend-edc-oauth
name: {{ .Release.Name }}-backend-edc-oauth
- name: "oauth.apiKey"
valueFrom:
secretKeyRef:
key: xApiKey
name: {{ .Release.Name }}-backend-auth
volumeMounts:
{{- toYaml .Values.backend.volumeMounts | nindent 12 }}
ports:
Expand All @@ -101,4 +106,3 @@ spec:
{{- end }}
volumes:
{{- tpl (toYaml .Values.backend.volumes | nindent 12) .}}

6 changes: 4 additions & 2 deletions charts/digital-product-pass/templates/secret-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-avp-consumer-backend-auth
name: {{ .Release.Name }}-backend-auth
labels:
{{- include "chart.labels" . | nindent 4 }}
namespace: {{ .Values.namespace }}
Expand All @@ -34,12 +34,14 @@ stringData:
appId: {{ .Values.oauth.appId }}
clientId: {{ .Values.oauth.techUser.clientId }}
clientSecret: {{ .Values.oauth.techUser.clientSecret }}
xApiKey: {{ .Values.oauth.apiKey.secret }}

---

apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-avp-consumer-backend-edc-oauth
name: {{ .Release.Name }}-backend-edc-oauth

Check warning on line 44 in charts/digital-product-pass/templates/secret-backend.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used
labels:
{{- include "chart.labels" . | nindent 4 }}
namespace: {{ .Values.namespace }}
Expand Down
5 changes: 4 additions & 1 deletion charts/digital-product-pass/values-beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,7 @@ oauth:
enabled: true
bpn: *bpn
roleCheck:
enabled: false
enabled: false
apiKey:
header: "X-Api-Key"
secret: <path:material-pass/data/int/oauth#xApiKey>
5 changes: 4 additions & 1 deletion charts/digital-product-pass/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,7 @@ oauth:
enabled: true
bpn: *bpn
roleCheck:
enabled: false
enabled: false
apiKey:
header: "X-Api-Key"
secret: <path:material-pass/data/int/oauth#xApiKey>
11 changes: 10 additions & 1 deletion charts/digital-product-pass/values-int.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ backend:
discovery:
hostname: "semantics.int.demo.catena-x.net/discoveryfinder"

single-api:
maxRetries: 30
delay: 1000


frontend:
ingress:
enabled: true
Expand Down Expand Up @@ -105,4 +110,8 @@ oauth:
enabled: true
bpn: *bpn
roleCheck:
enabled: false
enabled: false
apiKey:
header: "X-Api-Key"
secret: <path:material-pass/data/int/oauth#xApiKey>

9 changes: 9 additions & 0 deletions charts/digital-product-pass/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ backend:
# -- edc discovery configuration
edcDiscovery:
key: "bpn"
# -- configuration to the single API endpoint
singleApi:
maxRetries: 30
delay: 1000

frontend:
name: "dpp-frontend"
Expand Down Expand Up @@ -366,6 +370,11 @@ oauth:
roleCheck:
enabled: false

# -- to authenticate against single API
apiKey:
header: "X-Api-Key"
secret: "<api-key>"

# Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm
# @url: https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-resource-requests-and-limits
resources:
Expand Down
5 changes: 5 additions & 0 deletions docs/arc42/Arc42.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ This API is responsible for retrieving the Aspect Model Payloads and some metada

Swagger Documentation: [https://dpp.int.demo.catena-x.net/swagger-ui/index.html](https://dpp.int.demo.catena-x.net/swagger-ui/index.html)

#### Single API
The Single API permits to get data from a Catena-X Provider by abstracting of all the separated APIs needed to do so. Authenticating with an defined API Key and with the mandatory and given serialized and discovery identifications, this API will
create the process and check for the viability of the data retrieval, searches for a passport with the given serialized id, automatically signs the contract retrieved from provider and start negotiation, waits for the negotiation
to be done and returns the data negotiated and transferred. In short, it's the set of the various APIs in one with auto-sign functionality to agile the data retrieval in a simple way.


### Item Relationship Service Integration (Drill Down Functionality)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Expand the name of the chart.
*/}}
{{- define "chart.name" -}}
{{- default .Chart.Name .Values.name | trunc 63 | trimSuffix "-" }}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Expand All @@ -36,9 +36,9 @@ If release name contains chart name it will be used as a full name.
*/}}
{{- define "chart.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.name | trunc 63 | trimSuffix "-" }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.name }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -57,6 +57,7 @@ Create chart name and version as used by the chart label.
{{/*
Common labels
*/}}

{{- define "chart.labels" -}}
helm.sh/chart: {{ include "chart.chart" . }}
{{ include "chart.selectorLabels" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: backend-config
name: {{ .Release.Name }}-backend-config
namespace: {{ .Values.namespace }}
data:
application.yaml: |-
application.yaml: |-
spring:
name: "Digital Product Passport Consumer Backend"
main:
Expand Down Expand Up @@ -57,6 +57,7 @@ data:
# -- edc consumer connection configuration
edc:
endpoint: "https://{{ .Values.edc.hostname }}"
readiness: {{ .Values.edc.apis.readiness }}
management: {{ .Values.edc.apis.management }}
catalog: {{ .Values.edc.apis.catalog }}
negotiation: {{ .Values.edc.apis.negotiation }}
Expand All @@ -73,6 +74,8 @@ data:
startUpChecks:
bpnCheck: {{ .Values.securityCheck.bpn }}
edcCheck: {{ .Values.securityCheck.edc }}
authentication:
header: {{ .Values.oauth.apiKey.header }}
# -- irs configuration
irs:
enabled: {{ .Values.irs.enabled }} # -- Enable search for children in the requests
Expand Down Expand Up @@ -123,6 +126,10 @@ data:
# -- edc discovery configuration
edc:
key: {{ tpl (.Values.discovery.edcDiscovery.key | default "bpn") . | quote }}
# -- configuration to the single API endpoint
single-api:
maxRetries: {{ .Values.singleApi.maxRetries }}
delay: {{ .Values.singleApi.delay }}
# -- process configuration
process:
# -- directory for storing the contract negotiation files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,36 +65,34 @@ spec:
valueFrom:
secretKeyRef:
key: appId
name: avp-consumer-backend-oauth
name: {{ .Release.Name }}-backend-auth
- name: "client.id"
valueFrom:
secretKeyRef:
key: clientId
name: consumer-backend-oauth
name: {{ .Release.Name }}-backend-auth
- name: "client.secret"
valueFrom:
secretKeyRef:
key: clientSecret
name: consumer-backend-oauth
name: {{ .Release.Name }}-backend-auth
- name: "edc.apiKey"
valueFrom:
secretKeyRef:
key: xApiKey
name: consumer-edc
name: {{ .Release.Name }}-backend-edc-oauth
- name: "edc.participantId"
valueFrom:
secretKeyRef:
key: participantId
name: consumer-edc
name: {{ .Release.Name }}-backend-edc-oauth
- name: "oauth.apiKey"
valueFrom:
secretKeyRef:
key: xApiKey
name: {{ .Release.Name }}-backend-auth
volumeMounts:
- name: backend-config
mountPath: /app/config
- name: pvc-backend
mountPath: /app/data/process
subPath: data/process
- name: pvc-backend
mountPath: /app/log
subPath: log
{{- toYaml .Values.volumeMounts | nindent 12 }}
ports:
- name: http
containerPort: 8888
Expand Down Expand Up @@ -122,9 +120,4 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: backend-config
configMap:
name: backend-config
- name: pvc-backend
persistentVolumeClaim:
claimName: pvc-data
{{- tpl (toYaml .Values.volumes | nindent 12) .}}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-data
name: {{ .Release.Name }}-pvc-data
labels:
{{- include "chart.labels" . | nindent 4 }}
namespace: {{ .Values.namespace }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
apiVersion: v1
kind: Secret
metadata:
name: consumer-backend-oauth
name: {{ .Release.Name }}-backend-auth
labels:
{{- include "chart.labels" . | nindent 4 }}
namespace: {{ .Values.namespace }}
Expand All @@ -34,12 +34,13 @@ stringData:
appId: {{ .Values.oauth.appId }}
clientId: {{ .Values.oauth.techUser.clientId }}
clientSecret: {{ .Values.oauth.techUser.clientSecret }}
xApiKey: {{ .Values.oauth.apiKey.secret }}
---

apiVersion: v1
kind: Secret
metadata:
name: consumer-edc
name: {{ .Release.Name }}-backend-edc-oauth
labels:
{{- include "chart.labels" . | nindent 4 }}
namespace: {{ .Values.namespace }}
Expand Down
Loading

0 comments on commit 04a7f94

Please sign in to comment.