From c7fc91bf9bbcd9b9c413a33da199f7eee56d6f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Goinvic?= Date: Wed, 27 Nov 2024 17:56:27 +0100 Subject: [PATCH] charts schemas: restructure json files --- .../common}/containersSecurityContext.json | 0 .../common}/credential.json | 0 .../{sub_schemas => source/common}/ess.json | 2 +- .../common}/essLibrary.json | 0 .../common}/extraEnv.json | 0 .../common}/global.json | 0 .../common}/hostAliases.json | 0 .../{sub_schemas => source/common}/image.json | 0 .../common}/ingress.json | 0 .../common}/labels.json | 0 .../common}/nodeSelector.json | 0 .../common}/persistentVolumeClaim.json | 0 .../common}/podSecurityContext.json | 0 .../common}/postgres-libpq.json | 2 +- .../common}/resources.json | 0 .../common}/serviceAccount.json | 0 .../common}/serviceMonitors.json | 0 .../common}/sub_schema_values.yaml.j2 | 0 .../common}/tolerations.json | 0 .../common}/workloadAnnotations.json | 0 .../source/element-web/values.schema.json | 22 ++-- .../ingress_with_additional_paths.json | 0 .../{sub_schemas => }/scalable_worker.json | 2 +- .../{sub_schemas => }/single_worker.json | 2 +- .../synapse_sub_schema_values.yaml.j2 | 0 .../source/synapse/values.schema.json | 114 +++++++++--------- charts/matrix-stack/source/values.schema.json | 4 +- scripts/construct_helm_values.py | 8 +- 28 files changed, 76 insertions(+), 80 deletions(-) rename charts/matrix-stack/{sub_schemas => source/common}/containersSecurityContext.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/credential.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/ess.json (83%) rename charts/matrix-stack/{sub_schemas => source/common}/essLibrary.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/extraEnv.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/global.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/hostAliases.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/image.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/ingress.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/labels.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/nodeSelector.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/persistentVolumeClaim.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/podSecurityContext.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/postgres-libpq.json (87%) rename charts/matrix-stack/{sub_schemas => source/common}/resources.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/serviceAccount.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/serviceMonitors.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/sub_schema_values.yaml.j2 (100%) rename charts/matrix-stack/{sub_schemas => source/common}/tolerations.json (100%) rename charts/matrix-stack/{sub_schemas => source/common}/workloadAnnotations.json (100%) rename charts/matrix-stack/source/synapse/{sub_schemas => }/ingress_with_additional_paths.json (100%) rename charts/matrix-stack/source/synapse/{sub_schemas => }/scalable_worker.json (76%) rename charts/matrix-stack/source/synapse/{sub_schemas => }/single_worker.json (62%) rename charts/matrix-stack/source/synapse/{sub_schemas => }/synapse_sub_schema_values.yaml.j2 (100%) diff --git a/charts/matrix-stack/sub_schemas/containersSecurityContext.json b/charts/matrix-stack/source/common/containersSecurityContext.json similarity index 100% rename from charts/matrix-stack/sub_schemas/containersSecurityContext.json rename to charts/matrix-stack/source/common/containersSecurityContext.json diff --git a/charts/matrix-stack/sub_schemas/credential.json b/charts/matrix-stack/source/common/credential.json similarity index 100% rename from charts/matrix-stack/sub_schemas/credential.json rename to charts/matrix-stack/source/common/credential.json diff --git a/charts/matrix-stack/sub_schemas/ess.json b/charts/matrix-stack/source/common/ess.json similarity index 83% rename from charts/matrix-stack/sub_schemas/ess.json rename to charts/matrix-stack/source/common/ess.json index 44c36cda..988bf46e 100644 --- a/charts/matrix-stack/sub_schemas/ess.json +++ b/charts/matrix-stack/source/common/ess.json @@ -6,7 +6,7 @@ "type": "string" }, "labels": { - "$ref": "file://./../../matrix-stack/sub_schemas/labels.json" + "$ref": "file://./common/labels.json" }, "imagePullSecrets": { "type": "array", diff --git a/charts/matrix-stack/sub_schemas/essLibrary.json b/charts/matrix-stack/source/common/essLibrary.json similarity index 100% rename from charts/matrix-stack/sub_schemas/essLibrary.json rename to charts/matrix-stack/source/common/essLibrary.json diff --git a/charts/matrix-stack/sub_schemas/extraEnv.json b/charts/matrix-stack/source/common/extraEnv.json similarity index 100% rename from charts/matrix-stack/sub_schemas/extraEnv.json rename to charts/matrix-stack/source/common/extraEnv.json diff --git a/charts/matrix-stack/sub_schemas/global.json b/charts/matrix-stack/source/common/global.json similarity index 100% rename from charts/matrix-stack/sub_schemas/global.json rename to charts/matrix-stack/source/common/global.json diff --git a/charts/matrix-stack/sub_schemas/hostAliases.json b/charts/matrix-stack/source/common/hostAliases.json similarity index 100% rename from charts/matrix-stack/sub_schemas/hostAliases.json rename to charts/matrix-stack/source/common/hostAliases.json diff --git a/charts/matrix-stack/sub_schemas/image.json b/charts/matrix-stack/source/common/image.json similarity index 100% rename from charts/matrix-stack/sub_schemas/image.json rename to charts/matrix-stack/source/common/image.json diff --git a/charts/matrix-stack/sub_schemas/ingress.json b/charts/matrix-stack/source/common/ingress.json similarity index 100% rename from charts/matrix-stack/sub_schemas/ingress.json rename to charts/matrix-stack/source/common/ingress.json diff --git a/charts/matrix-stack/sub_schemas/labels.json b/charts/matrix-stack/source/common/labels.json similarity index 100% rename from charts/matrix-stack/sub_schemas/labels.json rename to charts/matrix-stack/source/common/labels.json diff --git a/charts/matrix-stack/sub_schemas/nodeSelector.json b/charts/matrix-stack/source/common/nodeSelector.json similarity index 100% rename from charts/matrix-stack/sub_schemas/nodeSelector.json rename to charts/matrix-stack/source/common/nodeSelector.json diff --git a/charts/matrix-stack/sub_schemas/persistentVolumeClaim.json b/charts/matrix-stack/source/common/persistentVolumeClaim.json similarity index 100% rename from charts/matrix-stack/sub_schemas/persistentVolumeClaim.json rename to charts/matrix-stack/source/common/persistentVolumeClaim.json diff --git a/charts/matrix-stack/sub_schemas/podSecurityContext.json b/charts/matrix-stack/source/common/podSecurityContext.json similarity index 100% rename from charts/matrix-stack/sub_schemas/podSecurityContext.json rename to charts/matrix-stack/source/common/podSecurityContext.json diff --git a/charts/matrix-stack/sub_schemas/postgres-libpq.json b/charts/matrix-stack/source/common/postgres-libpq.json similarity index 87% rename from charts/matrix-stack/sub_schemas/postgres-libpq.json rename to charts/matrix-stack/source/common/postgres-libpq.json index 359d8a35..3e6c33f0 100644 --- a/charts/matrix-stack/sub_schemas/postgres-libpq.json +++ b/charts/matrix-stack/source/common/postgres-libpq.json @@ -27,7 +27,7 @@ ] }, "password": { - "$ref": "file://./../../matrix-stack/sub_schemas/credential.json" + "$ref": "file://./common/credential.json" } } } diff --git a/charts/matrix-stack/sub_schemas/resources.json b/charts/matrix-stack/source/common/resources.json similarity index 100% rename from charts/matrix-stack/sub_schemas/resources.json rename to charts/matrix-stack/source/common/resources.json diff --git a/charts/matrix-stack/sub_schemas/serviceAccount.json b/charts/matrix-stack/source/common/serviceAccount.json similarity index 100% rename from charts/matrix-stack/sub_schemas/serviceAccount.json rename to charts/matrix-stack/source/common/serviceAccount.json diff --git a/charts/matrix-stack/sub_schemas/serviceMonitors.json b/charts/matrix-stack/source/common/serviceMonitors.json similarity index 100% rename from charts/matrix-stack/sub_schemas/serviceMonitors.json rename to charts/matrix-stack/source/common/serviceMonitors.json diff --git a/charts/matrix-stack/sub_schemas/sub_schema_values.yaml.j2 b/charts/matrix-stack/source/common/sub_schema_values.yaml.j2 similarity index 100% rename from charts/matrix-stack/sub_schemas/sub_schema_values.yaml.j2 rename to charts/matrix-stack/source/common/sub_schema_values.yaml.j2 diff --git a/charts/matrix-stack/sub_schemas/tolerations.json b/charts/matrix-stack/source/common/tolerations.json similarity index 100% rename from charts/matrix-stack/sub_schemas/tolerations.json rename to charts/matrix-stack/source/common/tolerations.json diff --git a/charts/matrix-stack/sub_schemas/workloadAnnotations.json b/charts/matrix-stack/source/common/workloadAnnotations.json similarity index 100% rename from charts/matrix-stack/sub_schemas/workloadAnnotations.json rename to charts/matrix-stack/source/common/workloadAnnotations.json diff --git a/charts/matrix-stack/source/element-web/values.schema.json b/charts/matrix-stack/source/element-web/values.schema.json index a714d7ce..00d3760d 100644 --- a/charts/matrix-stack/source/element-web/values.schema.json +++ b/charts/matrix-stack/source/element-web/values.schema.json @@ -23,37 +23,37 @@ "type": "integer" }, "ess-library": { - "$ref": "file://./../sub_schemas/essLibrary.json" + "$ref": "file://./common/essLibrary.json" }, "image": { - "$ref": "file://./../sub_schemas/image.json" + "$ref": "file://./common/image.json" }, "ingress": { - "$ref": "file://./../sub_schemas/ingress.json" + "$ref": "file://./common/ingress.json" }, "labels": { - "$ref": "file://./../sub_schemas/labels.json" + "$ref": "file://./common/labels.json" }, "annotations": { - "$ref": "file://./../sub_schemas/workloadAnnotations.json" + "$ref": "file://./common/workloadAnnotations.json" }, "containersSecurityContext": { - "$ref": "file://./../sub_schemas/containersSecurityContext.json" + "$ref": "file://./common/containersSecurityContext.json" }, "nodeSelector": { - "$ref": "file://./../sub_schemas/nodeSelector.json" + "$ref": "file://./common/nodeSelector.json" }, "podSecurityContext": { - "$ref": "file://./../sub_schemas/podSecurityContext.json" + "$ref": "file://./common/podSecurityContext.json" }, "resources": { - "$ref": "file://./../sub_schemas/resources.json" + "$ref": "file://./common/resources.json" }, "serviceAccount": { - "$ref": "file://./../sub_schemas/serviceAccount.json" + "$ref": "file://./common/serviceAccount.json" }, "tolerations": { - "$ref": "file://./../sub_schemas/tolerations.json" + "$ref": "file://./common/tolerations.json" } } } diff --git a/charts/matrix-stack/source/synapse/sub_schemas/ingress_with_additional_paths.json b/charts/matrix-stack/source/synapse/ingress_with_additional_paths.json similarity index 100% rename from charts/matrix-stack/source/synapse/sub_schemas/ingress_with_additional_paths.json rename to charts/matrix-stack/source/synapse/ingress_with_additional_paths.json diff --git a/charts/matrix-stack/source/synapse/sub_schemas/scalable_worker.json b/charts/matrix-stack/source/synapse/scalable_worker.json similarity index 76% rename from charts/matrix-stack/source/synapse/sub_schemas/scalable_worker.json rename to charts/matrix-stack/source/synapse/scalable_worker.json index 06bfd2a7..9aa97762 100644 --- a/charts/matrix-stack/source/synapse/sub_schemas/scalable_worker.json +++ b/charts/matrix-stack/source/synapse/scalable_worker.json @@ -11,7 +11,7 @@ "minimum": 1 }, "resources": { - "$ref": "file://./../../matrix-stack/sub_schemas/resources.json" + "$ref": "file://./common/resources.json" } }, "type": "object" diff --git a/charts/matrix-stack/source/synapse/sub_schemas/single_worker.json b/charts/matrix-stack/source/synapse/single_worker.json similarity index 62% rename from charts/matrix-stack/source/synapse/sub_schemas/single_worker.json rename to charts/matrix-stack/source/synapse/single_worker.json index 08bbbffc..3aa029f1 100644 --- a/charts/matrix-stack/source/synapse/sub_schemas/single_worker.json +++ b/charts/matrix-stack/source/synapse/single_worker.json @@ -4,7 +4,7 @@ "type": "boolean" }, "resources": { - "$ref": "file://./../../matrix-stack/sub_schemas/resources.json" + "$ref": "file://./common/resources.json" } }, "type": "object" diff --git a/charts/matrix-stack/source/synapse/sub_schemas/synapse_sub_schema_values.yaml.j2 b/charts/matrix-stack/source/synapse/synapse_sub_schema_values.yaml.j2 similarity index 100% rename from charts/matrix-stack/source/synapse/sub_schemas/synapse_sub_schema_values.yaml.j2 rename to charts/matrix-stack/source/synapse/synapse_sub_schema_values.yaml.j2 diff --git a/charts/matrix-stack/source/synapse/values.schema.json b/charts/matrix-stack/source/synapse/values.schema.json index 112dbe00..f98248c0 100644 --- a/charts/matrix-stack/source/synapse/values.schema.json +++ b/charts/matrix-stack/source/synapse/values.schema.json @@ -7,24 +7,24 @@ "type": "boolean" }, "postgres": { - "$ref": "file://../sub_schemas/postgres-libpq.json" + "$ref": "file://./common/postgres-libpq.json" }, "media": { "type": "object", "properties": { "storage": { - "$ref": "file://../sub_schemas/persistentVolumeClaim.json" + "$ref": "file://./common/persistentVolumeClaim.json" } } }, "macaroon": { - "$ref": "file://../sub_schemas/credential.json" + "$ref": "file://./common/credential.json" }, "registrationSharedSecret": { - "$ref": "file://../sub_schemas/credential.json" + "$ref": "file://./common/credential.json" }, "signingKey": { - "$ref": "file://../sub_schemas/credential.json" + "$ref": "file://./common/credential.json" }, "additional": { "type": "object", @@ -96,106 +96,106 @@ } }, "global": { - "$ref": "file://../sub_schemas/global.json" + "$ref": "file://./common/global.json" }, "ess-library": { - "$ref": "file://../sub_schemas/essLibrary.json" + "$ref": "file://./common/essLibrary.json" }, "ingress": { - "$ref": "file://./synapse/sub_schemas/ingress_with_additional_paths.json" + "$ref": "file://./synapse/ingress_with_additional_paths.json" }, "image": { - "$ref": "file://../sub_schemas/image.json" + "$ref": "file://./common/image.json" }, "labels": { - "$ref": "file://../sub_schemas/labels.json" + "$ref": "file://./common/labels.json" }, "annotations": { - "$ref": "file://../sub_schemas/workloadAnnotations.json" + "$ref": "file://./common/workloadAnnotations.json" }, "containersSecurityContext": { - "$ref": "file://../sub_schemas/containersSecurityContext.json" + "$ref": "file://./common/containersSecurityContext.json" }, "extraEnv": { - "$ref": "file://../sub_schemas/extraEnv.json" + "$ref": "file://./common/extraEnv.json" }, "hostAliases": { - "$ref": "file://../sub_schemas/hostAliases.json" + "$ref": "file://./common/hostAliases.json" }, "nodeSelector": { - "$ref": "file://../sub_schemas/nodeSelector.json" + "$ref": "file://./common/nodeSelector.json" }, "podSecurityContext": { - "$ref": "file://../sub_schemas/podSecurityContext.json" + "$ref": "file://./common/podSecurityContext.json" }, "resources": { - "$ref": "file://../sub_schemas/resources.json" + "$ref": "file://./common/resources.json" }, "serviceAccount": { - "$ref": "file://../sub_schemas/serviceAccount.json" + "$ref": "file://./common/serviceAccount.json" }, "serviceMonitors": { - "$ref": "file://../sub_schemas/serviceMonitors.json" + "$ref": "file://./common/serviceMonitors.json" }, "tolerations": { - "$ref": "file://../sub_schemas/tolerations.json" + "$ref": "file://./common/tolerations.json" }, "workers": { "type": "object", "properties": { "appservice": { - "$ref": "file://./synapse/sub_schemas/single_worker.json" + "$ref": "file://./synapse/single_worker.json" }, "background": { - "$ref": "file://./synapse/sub_schemas/single_worker.json" + "$ref": "file://./synapse/single_worker.json" }, "client-reader": { - "$ref": "file://./synapse/sub_schemas/scalable_worker.json" + "$ref": "file://./synapse/scalable_worker.json" }, "encryption": { - "$ref": "file://./synapse/sub_schemas/single_worker.json" + "$ref": "file://./synapse/single_worker.json" }, "event-creator": { - "$ref": "file://./synapse/sub_schemas/scalable_worker.json" + "$ref": "file://./synapse/scalable_worker.json" }, "event-persister": { - "$ref": "file://./synapse/sub_schemas/scalable_worker.json" + "$ref": "file://./synapse/scalable_worker.json" }, "federation-reader": { - "$ref": "file://./synapse/sub_schemas/scalable_worker.json" + "$ref": "file://./synapse/scalable_worker.json" }, "federation-sender": { - "$ref": "file://./synapse/sub_schemas/scalable_worker.json" + "$ref": "file://./synapse/scalable_worker.json" }, "initial-synchrotron": { - "$ref": "file://./synapse/sub_schemas/scalable_worker.json" + "$ref": "file://./synapse/scalable_worker.json" }, "media-repository": { - "$ref": "file://./synapse/sub_schemas/single_worker.json" + "$ref": "file://./synapse/single_worker.json" }, "presence-writer": { - "$ref": "file://./synapse/sub_schemas/single_worker.json" + "$ref": "file://./synapse/single_worker.json" }, "pusher": { - "$ref": "file://./synapse/sub_schemas/scalable_worker.json" + "$ref": "file://./synapse/scalable_worker.json" }, "receipts-account": { - "$ref": "file://./synapse/sub_schemas/single_worker.json" + "$ref": "file://./synapse/single_worker.json" }, "sliding-sync": { - "$ref": "file://./synapse/sub_schemas/scalable_worker.json" + "$ref": "file://./synapse/scalable_worker.json" }, "sso-login": { - "$ref": "file://./synapse/sub_schemas/single_worker.json" + "$ref": "file://./synapse/single_worker.json" }, "synchrotron": { - "$ref": "file://./synapse/sub_schemas/scalable_worker.json" + "$ref": "file://./synapse/scalable_worker.json" }, "typing-persister": { - "$ref": "file://./synapse/sub_schemas/single_worker.json" + "$ref": "file://./synapse/single_worker.json" }, "user-dir": { - "$ref": "file://./synapse/sub_schemas/single_worker.json" + "$ref": "file://./synapse/single_worker.json" } } }, @@ -207,34 +207,34 @@ "type": "integer" }, "image": { - "$ref": "file://../sub_schemas/image.json" + "$ref": "file://./common/image.json" }, "labels": { - "$ref": "file://../sub_schemas/labels.json" + "$ref": "file://./common/labels.json" }, "annotations": { - "$ref": "file://../sub_schemas/workloadAnnotations.json" + "$ref": "file://./common/workloadAnnotations.json" }, "containersSecurityContext": { - "$ref": "file://../sub_schemas/containersSecurityContext.json" + "$ref": "file://./common/containersSecurityContext.json" }, "nodeSelector": { - "$ref": "file://../sub_schemas/nodeSelector.json" + "$ref": "file://./common/nodeSelector.json" }, "podSecurityContext": { - "$ref": "file://../sub_schemas/podSecurityContext.json" + "$ref": "file://./common/podSecurityContext.json" }, "resources": { - "$ref": "file://../sub_schemas/resources.json" + "$ref": "file://./common/resources.json" }, "serviceAccount": { - "$ref": "file://../sub_schemas/serviceAccount.json" + "$ref": "file://./common/serviceAccount.json" }, "serviceMonitors": { - "$ref": "file://../sub_schemas/serviceMonitors.json" + "$ref": "file://./common/serviceMonitors.json" }, "tolerations": { - "$ref": "file://../sub_schemas/tolerations.json" + "$ref": "file://./common/tolerations.json" } } }, @@ -242,31 +242,31 @@ "type": "object", "properties": { "image": { - "$ref": "file://../sub_schemas/image.json" + "$ref": "file://./common/image.json" }, "labels": { - "$ref": "file://../sub_schemas/labels.json" + "$ref": "file://./common/labels.json" }, "annotations": { - "$ref": "file://../sub_schemas/workloadAnnotations.json" + "$ref": "file://./common/workloadAnnotations.json" }, "containersSecurityContext": { - "$ref": "file://../sub_schemas/containersSecurityContext.json" + "$ref": "file://./common/containersSecurityContext.json" }, "nodeSelector": { - "$ref": "file://../sub_schemas/nodeSelector.json" + "$ref": "file://./common/nodeSelector.json" }, "podSecurityContext": { - "$ref": "file://../sub_schemas/podSecurityContext.json" + "$ref": "file://./common/podSecurityContext.json" }, "resources": { - "$ref": "file://../sub_schemas/resources.json" + "$ref": "file://./common/resources.json" }, "serviceAccount": { - "$ref": "file://../sub_schemas/serviceAccount.json" + "$ref": "file://./common/serviceAccount.json" }, "tolerations": { - "$ref": "file://../sub_schemas/tolerations.json" + "$ref": "file://./common/tolerations.json" } } } diff --git a/charts/matrix-stack/source/values.schema.json b/charts/matrix-stack/source/values.schema.json index d380d404..934b947f 100644 --- a/charts/matrix-stack/source/values.schema.json +++ b/charts/matrix-stack/source/values.schema.json @@ -4,10 +4,10 @@ "type": "object", "properties": { "global": { - "$ref": "file://./../../matrix-stack/sub_schemas/global.json" + "$ref": "file://./common/global.json" }, "ess": { - "$ref": "file://./../../matrix-stack/sub_schemas/ess.json" + "$ref": "file://./common/ess.json" }, "elementWeb": { "$ref": "file://./element-web/values.schema.json" diff --git a/scripts/construct_helm_values.py b/scripts/construct_helm_values.py index f3435f98..d993fa4f 100755 --- a/scripts/construct_helm_values.py +++ b/scripts/construct_helm_values.py @@ -13,23 +13,19 @@ from jinja2 import Environment, FileSystemLoader, select_autoescape def find_sub_dirs(root_dir, dir_name): sub_schemas_dirs = [] - for path in Path(root_dir).rglob(dir_name): + for path in Path(root_dir).glob('*'): if path.is_dir(): sub_schemas_dirs.append(path) return sub_schemas_dirs def construct_values_file(source_values_template_path: Path, destination_values_path: Path): - charts_path = Path(__file__).parent.parent / "charts" - shared_sub_schemas_path = "matrix-stack" / charts_path / "sub_schemas" + charts_path = Path(__file__).parent.parent / "charts" / "matrix-stack" / "source" - chart_sub_schemas_path = source_values_template_path.parent / "sub_schemas" env = Environment( loader=FileSystemLoader( [ source_values_template_path.parent, - shared_sub_schemas_path, - chart_sub_schemas_path, charts_path, *find_sub_dirs(charts_path, "sub_schemas"), ]