From 2e46817c58c3f553c1e2b18f8e0a59fa17fcdd68 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Tue, 24 Sep 2024 07:55:50 +0200 Subject: [PATCH] feat(seeding): move configmap into own file Refs: #205 --- .../templates/configmap-seeding-testdata.yaml | 67 +++++++++++++++++++ .../templates/job-issuer-migrations.yaml | 1 + charts/ssi-credential-issuer/values.yaml | 2 +- .../argocd-app-templates/appsetup-int.yaml | 42 ------------ environments/helm-values/values-int.yaml | 3 + 5 files changed, 72 insertions(+), 43 deletions(-) create mode 100644 charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml diff --git a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml new file mode 100644 index 0000000..cfb44bc --- /dev/null +++ b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml @@ -0,0 +1,67 @@ +{{- /* +* 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.postgresql.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-issuer-cm-seeding-testdata + namespace: {{ .Release.Namespace }} +data: + use_cases.test.json: |- + [ + { + "id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9", + "name": "None", + "shortname": "None" + } + ] + verified_credential_external_type_detail_versions.test.json: |- + [ + { + "id": "d0f05b79-792c-4cb8-9b8d-6e476ac2e926", + "verified_credential_external_type_id": 2, + "version": "0.0", + "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/231016_Catena-X_Use_Case_Framework_PCF.pdf", + "valid_from": "2023-01-01 00:00:00.000000 +00:00", + "expiry": "2023-12-31 00:00:00.000000 +00:00" + }, + { + "id": "2d17a933-f65f-49cd-84a9-cff299a79f85", + "verified_credential_external_type_id": 11, + "version": "1.0", + "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/example.pdf", + "valid_from": "2024-10-16 00:00:00.000000 +00:00", + "expiry": "2025-10-16 00:00:00.000000 +00:00" + } + ] + verified_credential_type_assigned_external_types.test.json: |- + [ + { + "verified_credential_external_type_id": 11, + "verified_credential_type_id": 11 + } + ] + verified_credential_type_assigned_use_cases.test.json: |- + [ + { + "verified_credential_type_id": 11, + "use_case_id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9" + } + ] diff --git a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml index f134b9d..8b089c8 100644 --- a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml +++ b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml @@ -83,3 +83,4 @@ spec: protocol: TCP resources: {{- toYaml .Values.migrations.resources | nindent 10 }} + {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} diff --git a/charts/ssi-credential-issuer/values.yaml b/charts/ssi-credential-issuer/values.yaml index e7ae497..89c8f60 100644 --- a/charts/ssi-credential-issuer/values.yaml +++ b/charts/ssi-credential-issuer/values.yaml @@ -87,7 +87,7 @@ migrations: seeding: testDataEnvironments: "" testData: - # -- ConfigMap containing json files for the tables to seed, e.g. companies.test.json, addresses.test.json, etc. + # -- ConfigMap containing json files for the tables to seed, e.g. use_cases.json, verified_credential_external_type_detail_versions.test.json, etc. configMap: "" # -- Filename identifying the test data files e.g. for companies.test.json the value would be "test" filename: "" diff --git a/environments/argocd-app-templates/appsetup-int.yaml b/environments/argocd-app-templates/appsetup-int.yaml index c95d2e1..0e68c0b 100644 --- a/environments/argocd-app-templates/appsetup-int.yaml +++ b/environments/argocd-app-templates/appsetup-int.yaml @@ -36,45 +36,3 @@ spec: - name: helm_args value: '-f values.yaml -f ../../environments/helm-values/values-int.yaml' project: project-portal -data: - use_cases.test.json: |- - [ - { - "id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9", - "name": "None", - "shortname": "None" - } - ] - verified_credential_external_type_detail_versions.test.json: |- - [ - { - "id": "d0f05b79-792c-4cb8-9b8d-6e476ac2e926", - "verified_credential_external_type_id": 2, - "version": "0.0", - "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/231016_Catena-X_Use_Case_Framework_PCF.pdf", - "valid_from": "2023-01-01 00:00:00.000000 +00:00", - "expiry": "2023-12-31 00:00:00.000000 +00:00" - }, - { - "id": "2d17a933-f65f-49cd-84a9-cff299a79f85", - "verified_credential_external_type_id": 11, - "version": "1.0", - "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/example.pdf", - "valid_from": "2024-10-16 00:00:00.000000 +00:00", - "expiry": "2025-10-16 00:00:00.000000 +00:00" - } - ] - verified_credential_type_assigned_external_types.test.json: |- - [ - { - "verified_credential_external_type_id": 11, - "verified_credential_type_id": 11 - } - ] - verified_credential_type_assigned_use_cases.test.json: |- - [ - { - "verified_credential_type_id": 11, - "use_case_id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9" - } - ] diff --git a/environments/helm-values/values-int.yaml b/environments/helm-values/values-int.yaml index ef8b970..5f17b96 100644 --- a/environments/helm-values/values-int.yaml +++ b/environments/helm-values/values-int.yaml @@ -58,6 +58,9 @@ service: migrations: logging: default: "Debug" + testData: + configMap: "{{ .Release.Name }}-issuer-cm-seeding-testdata" + filename: "test" processesworker: logging: