Skip to content

Commit

Permalink
feat(seeding): adjust configuration for seeding data
Browse files Browse the repository at this point in the history
* make company and address for operator overwriteable
* add configuration to seed test data
* add configuration to add own config maps for seeding

Refs: #449 #447
  • Loading branch information
Phil91 committed Oct 16, 2024
1 parent 352627d commit 94ac460
Show file tree
Hide file tree
Showing 5 changed files with 409 additions and 21 deletions.
55 changes: 55 additions & 0 deletions charts/portal/templates/configmap-backend-seeding-initialdata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{{- /*
* 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.backend.portalmigrations.seeding.useInitial -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: "{{ include "portal.fullname" . }}-default-initialdata"
namespace: {{ .Release.Namespace }}
data:
addresses.test.json: |-
[
{
"id": "b4db3945-19a7-4a50-97d6-e66e8dfd04fb",
"date_created": "2022-03-24 18:01:33.306000 +00:00",
"date_last_changed": "2022-03-24 18:01:33.306000 +00:00",
"city": "Munich",
"region": null,
"streetadditional": null,
"streetname": "Street",
"streetnumber": "1",
"zipcode": "00001",
"country_alpha2code": "DE"
}
]
companies.test.json: |-
[
{
"id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87",
"date_created": "2022-03-24 18:01:33.306000 +00:00",
"business_partner_number": "{{ .Values.operator.bpn }}",
"name": "Catena-X",
"shortname": "Catena-X",
"company_status_id": 2,
"address_id": "b4db3945-19a7-4a50-97d6-e66e8dfd04fb",
"self_description_document_id": "00000000-0000-0000-0000-000000000009"
}
]
{{- end }}
280 changes: 280 additions & 0 deletions charts/portal/templates/configmap-backend-seeding-testdata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
{{- /*
* 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.backend.portalmigrations.seeding.seedTestData.useDefault -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: "{{ include "portal.fullname" . }}-default-testdata"
namespace: {{ .Release.Namespace }}
data:
addresses.test.json: |-
[
{
"id": "b4db3945-19a7-4a50-97d6-e66e8dfd04fe",
"date_created": "2022-03-24 18:01:33.306000 +00:00",
"date_last_changed": "2022-03-24 18:01:33.306000 +00:00",
"city": "Munich",
"region": null,
"streetadditional": null,
"streetname": "Street",
"streetnumber": "1",
"zipcode": "00001",
"country_alpha2code": "DE"
},
{
"id": "aa49c0ec-4e65-4115-a01c-7adfc36d220e",
"date_created": "2022-03-24 18:01:33.391000 +00:00",
"date_last_changed": "2022-03-24 18:01:33.391000 +00:00",
"city": "Munich",
"region": null,
"streetadditional": null,
"streetname": "Street",
"streetnumber": "4",
"zipcode": "00001",
"country_alpha2code": "DE"
},
{
"id": "86da3e1c-a634-41a6-ad44-9880746123e4",
"date_created": "2022-03-24 18:01:33.435000 +00:00",
"date_last_changed": "2022-03-24 18:01:33.435000 +00:00",
"city": "Munich",
"region": null,
"streetadditional": null,
"streetname": "Street",
"streetnumber": "6",
"zipcode": "00001",
"country_alpha2code": "DE"
},
{
"id": "0f562ea7-4cc1-47a9-bfee-b41b0ac67ebb",
"date_created": "2022-03-24 18:01:33.443000 +00:00",
"date_last_changed": "2022-03-24 18:01:33.443000 +00:00",
"city": "Munich",
"region": null,
"streetadditional": null,
"streetname": "Street",
"streetnumber": "7",
"zipcode": "00001",
"country_alpha2code": "DE"
},
{
"id": "081c8bfd-c6d1-4119-a5f8-a69726dfc11e",
"date_created": "2022-03-24 18:01:33.428000 +00:00",
"date_last_changed": "2022-03-24 18:01:33.428000 +00:00",
"city": "Munich",
"region": null,
"streetadditional": null,
"streetname": "Street",
"streetnumber": "9",
"zipcode": "00001",
"country_alpha2code": "DE"
},
{
"id": "081c8bfd-c6d1-4119-a5f8-a69726dfc11f",
"date_created": "2022-03-24 18:01:33.428000 +00:00",
"date_last_changed": "2022-03-24 18:01:33.428000 +00:00",
"city": "Munich",
"region": null,
"streetadditional": null,
"streetname": "Street",
"streetnumber": "9",
"zipcode": "00001",
"country_alpha2code": "DE"
},
{
"id": "f267f020-2caf-4d64-9aa1-20a6c123fe15",
"date_created": "2022-03-24 18:01:33.428000 +00:00",
"date_last_changed": "2022-03-24 18:01:33.428000 +00:00",
"city": "Munich",
"region": null,
"streetadditional": null,
"streetname": "Street",
"streetnumber": "9",
"zipcode": "00001",
"country_alpha2code": "DE"
}
]
companies.test.json: |-
[
{
"id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f88",
"date_created": "2022-03-24 18:01:33.306000 +00:00",
"business_partner_number": "BPNL00000003CRHL",
"name": "CX-Test-Access",
"shortname": "CX-Test-Access",
"company_status_id": 2,
"address_id": "b4db3945-19a7-4a50-97d6-e66e8dfd04fe",
"self_description_document_id": "f90962ee-a358-4381-8947-c56268ff32c7"
},
{
"id": "220330ac-170d-4e22-8d72-9467ed042149",
"date_created": "2022-03-24 18:01:33.393000 +00:00",
"business_partner_number": "BPNL00000001LLHA",
"name": "Car Factory 1",
"shortname": "Car Factory 1",
"company_status_id": 1,
"address_id": "aa49c0ec-4e65-4115-a01c-7adfc36d220e",
"self_description_document_id": "f90962ee-a358-4381-8947-c56268ff32c7"
},
{
"id": "bdac6865-2a8d-4bfd-9373-9dfce8190895",
"date_created": "2022-03-24 18:01:33.430000 +00:00",
"business_partner_number": "BPNL00000002LLHA",
"name": "Car Factory 2",
"shortname": "Car Factory 2",
"company_status_id": 1,
"address_id": "c0e1d802-0c4b-4d0d-a763-b6d9d56e6f07",
"self_description_document_id": "f90962ee-a358-4381-8947-c56268ff32c7"
},
{
"id": "41fd2ab8-71cd-4546-9bef-a388d91b2542",
"date_created": "2022-03-24 18:01:33.438000 +00:00",
"business_partner_number": "BPNL00000003LLHA",
"name": "Security Company",
"shortname": "Security Company",
"company_status_id": 1,
"address_id": "86da3e1c-a634-41a6-ad44-9880746123e4",
"self_description_document_id": "f90962ee-a358-4381-8947-c56268ff32c7"
},
{
"id": "d14eba77-0b18-4e41-9d84-49ef875c0763",
"date_created": "2022-03-24 18:01:33.442000 +00:00",
"business_partner_number": "BPNL00000003LLHB",
"name": "Dummy Corp. 1",
"shortname": "Dummy Corp. 1",
"company_status_id": 1,
"address_id": "0f562ea7-4cc1-47a9-bfee-b41b0ac67ebb",
"self_description_document_id": "f90962ee-a358-4381-8947-c56268ff32c7"
},
{
"id": "3390c2d7-75c1-4169-aa27-6ce00e1f3cdd",
"date_created": "2022-10-01 00:00:00.000000 +00:00",
"business_partner_number": "BPNL07800HZ01643",
"name": "Service Provider",
"shortname": "SP",
"company_status_id": 2,
"address_id": "081c8bfd-c6d1-4119-a5f8-a69726dfc11e",
"self_description_document_id": "f90962ee-a358-4381-8947-c56268ff32c7"
},
{
"id": "3390c2d7-75c1-4169-aa27-6ce00e1f3cde",
"date_created": "2022-10-01 00:00:00.000000 +00:00",
"business_partner_number": "BPNL00000003CSLL",
"name": "App Provider",
"shortname": "SP",
"company_status_id": 2,
"address_id": "081c8bfd-c6d1-4119-a5f8-a69726dfc11f",
"self_description_document_id": "f90962ee-a358-4381-8947-c56268ff32c7"
},
{
"id": "2647e4f9-0d11-479f-b927-643cd9321c00",
"date_created": "2022-10-01 00:00:00.000000 +00:00",
"business_partner_number": "BPNL000000001OSP",
"name": "Onboarding-Provider",
"shortname": "Onboarding-Provider",
"company_status_id": 2,
"address_id": "f267f020-2caf-4d64-9aa1-20a6c123fe15",
"self_description_document_id": "f90962ee-a358-4381-8947-c56268ff32c7"
}
]
connectors.test.json: |-
[
{
"id": "7e86a0b8-6903-496b-96d1-0ef508206833",
"name": "Test Connector 1",
"connector_url": "www.google.de",
"type_id": 1,
"status_id": 1,
"provider_id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87",
"host_id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87",
"location_id": "DE",
"self_description_document_id": null
},
{
"id": "7e86a0b8-6903-496b-96d1-0ef508206834",
"name": "Test Connector 2",
"connector_url": "www.google.de",
"type_id": 1,
"status_id": 2,
"provider_id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87",
"host_id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87",
"location_id": "DE",
"self_description_document_id": null
},
{
"id": "7e86a0b8-6903-496b-96d1-0ef508206835",
"name": "Test Connector 3",
"connector_url": "www.google.de",
"type_id": 1,
"status_id": 2,
"provider_id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87",
"host_id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87",
"location_id": "DE",
"self_description_document_id": null
},
{
"id": "7e86a0b8-6903-496b-96d1-0ef508206836",
"name": "Test Connector 4",
"connector_url": "www.google.de",
"type_id": 1,
"status_id": 2,
"provider_id": "ac861325-bc54-4583-bcdc-9e9f2a38ff84",
"host_id": "ac861325-bc54-4583-bcdc-9e9f2a38ff84",
"location_id": "DE",
"self_description_document_id": null
},
{
"id": "7e86a0b8-6903-496b-96d1-0ef508206837",
"name": "Test Connector 5",
"connector_url": "www.google.de",
"type_id": 1,
"status_id": 1,
"provider_id": "ac861325-bc54-4583-bcdc-9e9f2a38ff84",
"host_id": "ac861325-bc54-4583-bcdc-9e9f2a38ff84",
"location_id": "DE",
"self_description_document_id": null
},
{
"id": "7e86a0b8-6903-496b-96d1-0ef508206838",
"name": "Test Connector 6",
"connector_url": "www.google.de",
"type_id": 1,
"status_id": 1,
"provider_id": "cac8fa6a-9db7-4bad-9cbd-56298b74bac2",
"host_id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87",
"location_id": "DE",
"self_description_document_id": null
}
]
documents.test.json: |-
[
{
"id": "f90962ee-a358-4381-8947-c56268ff32c7",
"date_created": "2023-09-28T09:02:11.131663+00:00",
"document_hash": "riK1M7T4OZsSwX8Mx2RdxEXls9OFz+lcKgq0X+lhYg71F+y6bpUNcMeaYf1dC3xqFdA9W25KEjJlgOQ3Vo6sxg==",
"document_content": "ewogICJzZWxmRGVzY3JpcHRpb25DcmVkZW50aWFsIjogewogICAgIlNlcnZpY2VPZmZlcmluZyI6IHsKICAgICAgIkBjb250ZXh0IjogWwogICAgICAgICJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsCiAgICAgICAgImh0dHBzOi8vZjFjODI3ODUtNTU5OC00MWM3LWEwODMtMDFhOGUxYTgwZTE5Lm1vY2sucHN0bW4uaW8vY3R4c2QiCiAgICAgIF0sCiAgICAgICJ0eXBlIjogWwogICAgICAgICJWZXJpZmlhYmxlQ3JlZGVudGlhbCIKICAgICAgXSwKICAgICAgImlkIjogImh0dHBzOi8vY2FybGEuZGloLWNsb3VkLmNvbS90ZXN0L2NvbXBsaWFuY2Vfc2VydmljZS9wYXJ0aWNpcGFudC9CUE5MMDAwMDAwMDNBWlFQX3BhcnRpY2lwYW50Lmpzb24iLAogICAgICAiY3JlZGVudGlhbFN1YmplY3QiOiB7CiAgICAgICAgImJwbiI6ICJCUE5MSU5JVElBTERBVEFMT0FEIiwKICAgICAgICAicmVnaXN0cmF0aW9uTnVtYmVyIjogWwogICAgICAgICAgewogICAgICAgICAgICAidHlwZSI6ICJ2YXRJRCIsCiAgICAgICAgICAgICJ2YWx1ZSI6ICJERTI5MTYzNjAyOS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2XzcybEc3MjMtU0tmQ3FGZG9KUVBiT2s5UzFuOE5Eczc2dzVzSFV1VGJUQzZGT1JQNFk4U3dqZEF6RDUtb3V1RUhOeVVjMHA1aG9jd1NMTTFyaXFkeGZjeEJwSTVDbjVsa2hMVVlqUzlUR3NVcGJpc1NmNUx4TGk3S2JIVTNwRGZnSDBCZkU3MlMxb3dDSVRSRnR5WnNQbkR0NE9ZNjRxMzI4RGNPd0VEaXJzZ3NNMHBoUkp4dU9KQl9hdHdoaEhPR3JUOXpvZ1NOOFFxWVR6TVJBNGlyY1AzWjY2NTVlQXNmcXhRM21HRWptZTV2eFpHMWFtaFFQNjV0a1NqTVZNbFNnbTFvaWJDUmxXd09ySDZwWVpCa0hJMU1XZVc5Zm5sbTdwVWlpNUNoT3phaWJQZEZobU9uTUE5UFNKMEJRVk5qUVpRblVQRjNacmltVnNQNWhUN0g5VlVNTVhDN2VnQVR2OGVGZ2lNM19YQksySUNZamJRMjN2dXRCWUJmRFRfSXM0NWRoamlnZHQxX2I4dkV6TjNnWXJuTzV1SnhGZlV2SG52dEkxbjVFeldJUHBkZnNtWndXZlp2NzN0U1lRYzAwa3VhNXIzNU9UZG9YZFoxSjNPMmsiLAogICAgICAidmVyaWZpY2F0aW9uTWV0aG9kIjogImRpZDp3ZWI6Z3gtY29tcGxpYW5jZS50ZXN0LmRpaC1jbG91ZC5jb20iCiAgICB9CiAgfQp9",
"document_name": "SelfDescription_LegalPerson_CX-Test-Access.json",
"document_type_id": 8,
"document_status_id": 2,
"company_user_id": "ac1cf001-7fbc-1f2f-817f-bce058020006",
"media_type_id": 7
}
]
{{- end }}
Loading

0 comments on commit 94ac460

Please sign in to comment.