From c4e8f64e805d688099e80baeaaeaa5f5f8548f9e Mon Sep 17 00:00:00 2001
From: David Festal <dfestal@redhat.com>
Date: Mon, 2 Oct 2023 10:48:56 +0200
Subject: [PATCH] Add `dynamicPlugins` in Values schema.

Signed-off-by: David Festal <dfestal@redhat.com>
---
 charts/backstage/values.schema.json      | 40 ++++++++++++++++++++++++
 charts/backstage/values.schema.tmpl.json | 38 ++++++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/charts/backstage/values.schema.json b/charts/backstage/values.schema.json
index 0631dcb..8135916 100644
--- a/charts/backstage/values.schema.json
+++ b/charts/backstage/values.schema.json
@@ -8,6 +8,46 @@
                     "title": "Shorthand for users who do not want to specify a custom HOSTNAME. Used ONLY with the DEFAULT upstream.backstage.appConfig value and with OCP Route enabled.",
                     "type": "string"
                 },
+                "dynamic": {
+                    "additionalProperties": false,
+                    "properties": {
+                        "includes": {
+                            "default": [],
+                            "items": {
+                                "type": "string"
+                            },
+                            "title": "List of YAML files to include, each of which should contain a `plugins` array.",
+                            "type": "array"
+                        },
+                        "plugins": {
+                            "items": {
+                                "properties": {
+                                    "disabled": {
+                                        "default": false,
+                                        "title": "Disable the plugin.",
+                                        "type": "boolean"
+                                    },
+                                    "package": {
+                                        "title": "Package specification of the dynamic plugin to install. It should be usable by the `npm pack` command.",
+                                        "type": "string"
+                                    },
+                                    "pluginConfig": {
+                                        "title": "Optional plugin-specific app-config YAML fragment.",
+                                        "type": "object"
+                                    }
+                                },
+                                "required": [
+                                    "package"
+                                ],
+                                "type": "object"
+                            },
+                            "title": "List of dynamic plugins that should be installed in the backstage application.",
+                            "type": "array"
+                        }
+                    },
+                    "title": "Dynamic plugins configuration.",
+                    "type": "object"
+                },
                 "host": {
                     "default": "",
                     "title": "Custom hostname shorthand, overrides `global.clusterRouterBase`, `upstream.ingress.host`, `route.host`, and url values in `upstream.backstage.appConfig`",
diff --git a/charts/backstage/values.schema.tmpl.json b/charts/backstage/values.schema.tmpl.json
index d5d2a34..b9ad056 100644
--- a/charts/backstage/values.schema.tmpl.json
+++ b/charts/backstage/values.schema.tmpl.json
@@ -29,6 +29,44 @@
                     "title": "Custom hostname shorthand, overrides `global.clusterRouterBase`, `upstream.ingress.host`, `route.host`, and url values in `upstream.backstage.appConfig`",
                     "type": "string",
                     "default": ""
+                },
+                "dynamic": {
+                    "title": "Dynamic plugins configuration.",
+                    "type": "object",
+                    "additionalProperties": false,
+                    "properties": {
+                        "plugins": {
+                            "title": "List of dynamic plugins that should be installed in the backstage application.",
+                            "type": "array",
+                            "items": {
+                                "type": "object",
+                                "properties": {
+                                    "package": {
+                                        "title": "Package specification of the dynamic plugin to install. It should be usable by the `npm pack` command.",
+                                        "type": "string"
+                                    },
+                                    "pluginConfig": {
+                                        "title": "Optional plugin-specific app-config YAML fragment.",
+                                        "type": "object"
+                                    },
+                                    "disabled": {
+                                        "title": "Disable the plugin.",
+                                        "type": "boolean",
+                                        "default": false
+                                    }
+                                },
+                                "required": ["package"]
+                            }
+                        },
+                        "includes": {
+                            "title": "List of YAML files to include, each of which should contain a `plugins` array.",
+                            "type": "array",
+                            "items": {
+                                "type": "string"
+                            },
+                            "default": []
+                        }
+                    }
                 }
             }
         },