diff --git a/api/integreatly/v1alpha1/grafana_types.go b/api/integreatly/v1alpha1/grafana_types.go index d7e91fe3e..3314f651e 100644 --- a/api/integreatly/v1alpha1/grafana_types.go +++ b/api/integreatly/v1alpha1/grafana_types.go @@ -631,7 +631,19 @@ type GrafanaConfigPanels struct { type GrafanaConfigPlugins struct { // +nullable + // Set to true if you want to test alpha plugins that are not yet ready for general usage. Default is false. EnableAlpha *bool `json:"enable_alpha,omitempty" ini:"enable_alpha"` + // Enter a comma-separated list of plugin identifiers to identify plugins to load even if they are unsigned. Plugins with modified signatures are never loaded. + // We do not recommend using this option. For more information, refer to https://grafana.com/docs/grafana/next/administration/plugin-management/#plugin-signatures + AllowLoadingUnsignedPlugins string `json:"allow_loading_unsigned_plugins,omitempty" ini:"allow_loading_unsigned_plugins"` + // +nullable + // Available to Grafana administrators only, enables installing / uninstalling / updating plugins directly from the Grafana UI. Set to true by default. Setting it to false will hide the install / uninstall / update controls. + // For more information, refer to https://grafana.com/docs/grafana/next/administration/plugin-management/#plugin-catalog + PluginAdminEnabled *bool `json:"plugin_admin_enabled" ini:"plugin_admin_enabled"` + // Custom install/learn more URL for enterprise plugins. Defaults to https://grafana.com/grafana/plugins/. + PluginCatalogURL string `json:"plugin_catalog_url,omitempty" ini:"plugin_catalog_url"` + // Enter a comma-separated list of plugin identifiers to hide in the plugin catalog. + PluginCatalogHiddenPlugins string `json:"plugin_catalog_hidden_plugins,omitempty" ini:"plugin_catalog_hidden_plugins"` } type GrafanaConfigRendering struct { diff --git a/api/integreatly/v1alpha1/zz_generated.deepcopy.go b/api/integreatly/v1alpha1/zz_generated.deepcopy.go index c82c442c0..8da61e351 100644 --- a/api/integreatly/v1alpha1/zz_generated.deepcopy.go +++ b/api/integreatly/v1alpha1/zz_generated.deepcopy.go @@ -1043,6 +1043,11 @@ func (in *GrafanaConfigPlugins) DeepCopyInto(out *GrafanaConfigPlugins) { *out = new(bool) **out = **in } + if in.PluginAdminEnabled != nil { + in, out := &in.PluginAdminEnabled, &out.PluginAdminEnabled + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaConfigPlugins. diff --git a/config/crd/bases/integreatly.org_grafanas.yaml b/config/crd/bases/integreatly.org_grafanas.yaml index 8c656a7d1..ee6067c95 100644 --- a/config/crd/bases/integreatly.org_grafanas.yaml +++ b/config/crd/bases/integreatly.org_grafanas.yaml @@ -573,9 +573,35 @@ spec: type: object plugins: properties: + allow_loading_unsigned_plugins: + description: Enter a comma-separated list of plugin identifiers + to identify plugins to load even if they are unsigned. Plugins + with modified signatures are never loaded. We do not recommend + using this option. For more information, refer to https://grafana.com/docs/grafana/next/administration/plugin-management/#plugin-signatures + type: string enable_alpha: + description: Set to true if you want to test alpha plugins + that are not yet ready for general usage. Default is false. + nullable: true + type: boolean + plugin_admin_enabled: + description: Available to Grafana administrators only, enables + installing / uninstalling / updating plugins directly from + the Grafana UI. Set to true by default. Setting it to false + will hide the install / uninstall / update controls. For + more information, refer to https://grafana.com/docs/grafana/next/administration/plugin-management/#plugin-catalog nullable: true type: boolean + plugin_catalog_hidden_plugins: + description: Enter a comma-separated list of plugin identifiers + to hide in the plugin catalog. + type: string + plugin_catalog_url: + description: Custom install/learn more URL for enterprise + plugins. Defaults to https://grafana.com/grafana/plugins/. + type: string + required: + - plugin_admin_enabled type: object remote_cache: properties: diff --git a/controllers/config/grafanaIni.go b/controllers/config/grafanaIni.go index 17b1b785c..cc8d5f17a 100644 --- a/controllers/config/grafanaIni.go +++ b/controllers/config/grafanaIni.go @@ -284,6 +284,10 @@ func (i *GrafanaIni) parseConfig(config map[string][]string) map[string][]string if i.cfg.Plugins != nil { var items []string items = appendBool(items, "enable_alpha", i.cfg.Plugins.EnableAlpha) + items = appendStr(items, "allow_loading_unsigned_plugins", i.cfg.Plugins.AllowLoadingUnsignedPlugins) + items = appendBool(items, "plugin_admin_enabled", i.cfg.Plugins.PluginAdminEnabled) + items = appendStr(items, "plugin_catalog_url", i.cfg.Plugins.PluginCatalogURL) + items = appendStr(items, "plugin_catalog_hidden_items", i.cfg.Plugins.PluginCatalogHiddenPlugins) config["plugins"] = items } diff --git a/deploy/examples/GrafanaDevEnv.yaml b/deploy/examples/GrafanaDevEnv.yaml new file mode 100644 index 000000000..621e3212d --- /dev/null +++ b/deploy/examples/GrafanaDevEnv.yaml @@ -0,0 +1,45 @@ +# This example shows how to create a Grafana that allows alpha and unsigned plugins for testing custom plugins +apiVersion: integreatly.org/v1alpha1 +kind: Grafana +metadata: + name: example-dev-env-grafana +spec: + client: + preferService: true + ingress: + enabled: True + pathType: Prefix + path: "/" + config: + log: + mode: "console" + level: "error" + log.frontend: + enabled: true + auth: + disable_login_form: False + disable_signout_menu: True + auth.anonymous: + enabled: True + plugins: + enable_alpha: true + allow_loading_unsigned_plugins: 'my-internal-plugin1,my-internal-plugin2' + plugin_admin_enabled: true + plugin_catalog_url: http://my-internal-plugin-repo.example.com + plugin_catalog_hidden_plugins: 'hidden-plugin1,hidden-plugin2' + service: + name: "grafana-service" + labels: + app: "grafana" + type: "grafana-service" + dashboardLabelSelector: + - matchExpressions: + - { key: app, operator: In, values: [grafana] } + resources: + # Optionally specify container resources + limits: + cpu: 200m + memory: 200Mi + requests: + cpu: 100m + memory: 100Mi diff --git a/deploy/manifests/latest/crds.yaml b/deploy/manifests/latest/crds.yaml index 081fd89e7..8c1bb3c12 100644 --- a/deploy/manifests/latest/crds.yaml +++ b/deploy/manifests/latest/crds.yaml @@ -1224,9 +1224,35 @@ spec: type: object plugins: properties: + allow_loading_unsigned_plugins: + description: Enter a comma-separated list of plugin identifiers + to identify plugins to load even if they are unsigned. Plugins + with modified signatures are never loaded. We do not recommend + using this option. For more information, refer to https://grafana.com/docs/grafana/next/administration/plugin-management/#plugin-signatures + type: string enable_alpha: + description: Set to true if you want to test alpha plugins + that are not yet ready for general usage. Default is false. + nullable: true + type: boolean + plugin_admin_enabled: + description: Available to Grafana administrators only, enables + installing / uninstalling / updating plugins directly from + the Grafana UI. Set to true by default. Setting it to false + will hide the install / uninstall / update controls. For + more information, refer to https://grafana.com/docs/grafana/next/administration/plugin-management/#plugin-catalog nullable: true type: boolean + plugin_catalog_hidden_plugins: + description: Enter a comma-separated list of plugin identifiers + to hide in the plugin catalog. + type: string + plugin_catalog_url: + description: Custom install/learn more URL for enterprise + plugins. Defaults to https://grafana.com/grafana/plugins/. + type: string + required: + - plugin_admin_enabled type: object remote_cache: properties: diff --git a/documentation/api.md b/documentation/api.md index bb571ff97..8ad9cfc9f 100644 --- a/documentation/api.md +++ b/documentation/api.md @@ -4380,10 +4380,38 @@ GrafanaConfig is the configuration for grafana