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(seeding): make authorities bpn configurable via helm chart #80

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
60 changes: 60 additions & 0 deletions charts/ssi-asr/templates/configmap-seeding-initialdata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{- /*
* Copyright (c) 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
*/}}

{{- if .Values.migrations.seeding.useInitial -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-initial-data
namespace: {{ .Release.Namespace }}
data:
authorities.json: |-
[
{
"bpn": "{{ .Values.authorities.authorityOne.bpn }}"
},
{
"bpn": "{{ .Values.authorities.authorityTwo.bpn }}"
}
]
credential_authorities.json: |-
[
{
"credential_id": "255e01fc-65f6-43cd-8dfa-95e95fa95f60",
"bpn": "{{ .Values.authorities.authorityOne.bpn }}"
},
{
"credential_id": "255e01fc-65f6-43cd-8dfa-95e95fa95f61",
"bpn": "{{ .Values.authorities.authorityOne.bpn }}"
},
{
"credential_id": "10df6ecd-faa3-45ed-8da5-96261f6542dd",
"bpn": "{{ .Values.authorities.authorityOne.bpn }}"
},
{
"credential_id": "255e01fc-65f6-43cd-8dfa-95e95fa95f6b",
"bpn": "{{ .Values.authorities.authorityOne.bpn }}"
},
{
"credential_id": "255e01fc-65f6-43cd-8dfa-95e95fa95f6b",
"bpn": "{{ .Values.authorities.authorityTwo.bpn }}"
}
]

{{- end }}
18 changes: 15 additions & 3 deletions charts/ssi-asr/templates/job-registry-migrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ spec:
- name: "CONNECTIONSTRINGS__REGISTRYDB"
value: "Server={{ .Values.externalDatabase.host }};Database={{ .Values.externalDatabase.database }};Port={{ .Values.externalDatabase.port }};User Id={{ .Values.externalDatabase.username }};Password=$(REGISTRY_PASSWORD);Ssl Mode={{ .Values.dbConnection.sslMode }};"
{{- end }}
- name: "SEEDING__TESTDATAENVIRONMENTS__0"
value: "{{ .Values.migrations.seeding.testDataEnvironments }}"
- name: "SEEDING__DATAPATHS__0"
value: "{{ .Values.migrations.seeding.testDataPaths }}"
value: "Seeder/Data/"
- name: "SEEDING__DATAPATHS__1"
value: "Seeder/Data/overwrite"
- name: "SERILOG__MINIMUMLEVEL__Default"
value: "{{ .Values.migrations.logging.default }}"
ports:
Expand All @@ -79,3 +79,15 @@ spec:
protocol: TCP
resources:
{{- toYaml .Values.migrations.resources | nindent 10 }}
{{- if .Values.migrations.seeding.useInitial }}
volumeMounts:
- name: data-initial
mountPath: /migrations/Seeder/Data/overwrite
{{- end }}
{{- if .Values.migrations.seeding.useInitial }}
volumes:
- name: data-initial
configMap:
name: {{ .Release.Name }}-initial-data
optional: true
{{- end }}
14 changes: 12 additions & 2 deletions charts/ssi-asr/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
# SPDX-License-Identifier: Apache-2.0
###############################################################

# -- Set information related the authorities
authorities:
# -- The first authority
authorityOne:
bpn: "BPNL00000003CRHK"
# -- The second authority
authorityTwo:
bpn: "BPNL00000003CRHL"

service:
image:
name: "docker.io/tractusx/ssi-authority-schema-registry-service"
Expand Down Expand Up @@ -62,8 +71,9 @@ migrations:
cpu: 75m
memory: 200M
seeding:
testDataEnvironments: ""
testDataPaths: "Seeder/Data"
# -- Enables dynamic seeding of information related to the operator company: operator.bpn;
# If set to `true` the data configured in the config map 'configmap-seeding-initialdata.yaml' will be taken to insert the initial data;
useInitial: true
logging:
default: "Information"

Expand Down
1 change: 0 additions & 1 deletion environments/helm-values/values-int.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#
# SPDX-License-Identifier: Apache-2.0
###############################################################

ingress:
enabled: true
className: "nginx"
Expand Down
1 change: 0 additions & 1 deletion environments/helm-values/values-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#
# SPDX-License-Identifier: Apache-2.0
###############################################################

ingress:
enabled: true
className: "nginx"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"type_id": 2,
"name": "MembershipCredential"
},
{
"id": "255e01fc-65f6-43cd-8dfa-95e95fa95f6b",
"type_id": 4,
"name": "DismantlerCredential"
},
{
"id": "10df6ecd-faa3-45ed-8da5-96261f6542dd",
"type_id": 3,
"name": "DataExchangeGovernanceCredential"
},
{
"id": "255e01fc-65f6-43cd-8dfa-95e95fa95f6b",
"type_id": 4,
"name": "DismantlerCredential"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@

<None Remove="Seeder\Data" />
<Content Include="Seeder\Data\**" LinkBase="Seeder\Data" CopyToOutputDirectory="Always" />

<None Remove="Seeder\Data\overwrite" />
<Content Include="Seeder\Data\overwrite\**" LinkBase="Seeder\Data\overwrite" CopyToOutputDirectory="Always" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
},
"Seeding": {
"DataPaths": [
"Seeder/Data"
"Seeder/Data",
"Seeder/Data/overwrite"
],
"TestDataEnvironments": []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using Json.Schema;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling;
using Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Service.Models;
using System.Collections.Concurrent;
using System.Reflection;
using System.Text.Json;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public async Task InitializeAsync()
var seederOptions = Options.Create(new SeederSettings
{
TestDataEnvironments = ["test"],
DataPaths = ["Seeder/Data"]
DataPaths = ["Seeder/Data", "Seeder/Data/overwrite"]
});
var insertSeeder = new BatchInsertSeeder(context,
LoggerFactory.Create(builder => builder.AddConsole()).CreateLogger<BatchInsertSeeder>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Service.Tests.Setup;
public class IntegrationTestFactory : WebApplicationFactory<RegistryBusinessLogic>, IAsyncLifetime
{
private static readonly string[] TestDataEnvironments = ["test"];
private static readonly string[] DataPaths = ["Seeder/Data"];
private static readonly string[] DataPaths = ["Seeder/Data", "Seeder/Data/overwrite"];

private readonly PostgreSqlContainer _container = new PostgreSqlBuilder()
.WithDatabase("test_db")
Expand Down