安装和查看动态插件


Red Hat Developer Hub 1.3

Red Hat Customer Content Services

摘要

管理用户可以安装和配置插件,使其他用户能够使用插件扩展 RHDH 功能。

前言

动态插件支持基于 backend 插件管理器软件包,它是一个在 app-config.yaml 文件中扫描配置的根目录(dynamicPlugins.rootDirectory )的服务,并动态加载它们。

您可以使用预安装 Red Hat Developer Hub 的动态插件,或者从公共 NPM registry 安装外部动态插件。

您可以将动态插件的配置存储在 Backstage 自定义资源(CR)可引用的 ConfigMap 对象中。

注意

如果 pluginConfig 字段引用环境变量,则必须在 secrets-rhdh secret 中定义变量。

流程

  1. 在 OpenShift Container Platform Web 控制台中选择 ConfigMaps 选项卡。
  2. Create ConfigMap
  3. Create ConfigMap 页面中,选择 Configure via 中的 YAML view 选项,并根据需要编辑该文件。

    使用 GitHub 动态插件的 ConfigMap 对象示例

    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: dynamic-plugins-rhdh
    data:
      dynamic-plugins.yaml: |
        includes:
          - dynamic-plugins.default.yaml
        plugins:
          - package: './dynamic-plugins/dist/backstage-plugin-catalog-backend-module-github-dynamic'
            disabled: false
            pluginConfig:
              catalog:
                providers:
                  github:
                    organization: "${GITHUB_ORG}"
                    schedule:
                      frequency: { minutes: 1 }
                      timeout: { minutes: 1 }
                      initialDelay: { seconds: 100 }

  4. Create
  5. 进入 Topology 视图。
  6. 点您要使用的 Red Hat Developer Hub 实例的溢出菜单,然后选择 Edit Backstage 以加载 Red Hat Developer Hub 实例的 YAML 视图。

    Operator 安装 2
  7. dynamicPluginsConfigMapName 字段添加到 Backstage CR。例如:

    apiVersion: rhdh.redhat.com/v1alpha1
    kind: Backstage
    metadata:
      name: my-rhdh
    spec:
      application:
    # ...
        dynamicPluginsConfigMapName: dynamic-plugins-rhdh
    # ...
  8. 点击 Save
  9. 返回到 Topology 视图并等待 Red Hat Developer Hub pod 启动。
  10. Open URL 图标以使用 Red Hat Developer Hub 平台以及新的配置更改。

验证

  • 通过在 Red Hat Developer Hub root URL 中附加 /api/dynamic-plugins-info/loaded-plugins 并检查插件列表来确保动态插件配置已被加载:

    插件列表示例

    [
      {
        "name": "backstage-plugin-catalog-backend-module-github-dynamic",
        "version": "0.5.2",
        "platform": "node",
        "role": "backend-plugin-module"
      },
      {
        "name": "backstage-plugin-techdocs",
        "version": "1.10.0",
        "role": "frontend-plugin",
        "platform": "web"
      },
      {
        "name": "backstage-plugin-techdocs-backend-dynamic",
        "version": "1.9.5",
        "platform": "node",
        "role": "backend-plugin"
      },
    ]

第 2 章 使用 Helm Chart 安装动态插件

您可以使用 Helm Chart 部署 Developer Hub 实例,它是一个灵活的安装方法。使用 Helm Chart,您可以侧将动态插件加载到 Developer Hub 实例中,而无需重新编译代码或重建容器。

要使用 Helm 在 Developer Hub 中安装动态插件,请在 Helm Chart 中添加以下 global.dynamic 参数:

  • 插件 :用于安装的动态插件列表。默认情况下,列表为空。您可以使用以下字段填充 plugins 列表:

    • 软件包 :您要安装的动态插件软件包的软件包规格。您可以使用软件包进行本地或外部动态插件安装。对于本地安装,请使用包含动态插件的本地文件夹的路径。对于外部安装,请使用公共 NPM 存储库中的软件包规格。
    • 完整性 (外部软件包必需):一个特定于软件包的 < alg>-<digest&gt; 形式的完整性校验和。支持的算法包括 sha256sha384sha512
    • pluginConfig :特定于插件的 app-config YAML 片段。如需更多信息,请参阅插件配置。
    • disabled :如果设为 true,则禁用动态插件。默认值: false
  • 包括 :使用相同语法的 YAML 文件列表。
注意

includes 文件中的 plugins 列表与主 Helm 值中的 plugins 列表合并。如果这两个插件列表中都提到了插件软件包,则主 Helm 值中的 plugins 字段会覆盖 includes 文件中的 plugins 字段。默认配置包含 dynamic-plugins.default.yaml 文件,其中包含 Developer Hub 中预安装的所有动态插件,无论是默认启用还是禁用。

2.1. 获取完整性 checksum

要获取完整性 checksum,请输入以下命令:

npm view <package name>@<version> dist.integrity

2.2. 动态插件安装的 Helm Chart 配置示例

以下示例演示了如何为特定类型的动态插件安装配置 Helm Chart。

当外部插件需要特定的 app-config 时,配置本地插件和外部插件

global:
  dynamic:
    plugins:
      - package: <alocal package-spec used by npm pack>
      - package: <external package-spec used by npm pack>
        integrity: sha512-<some hash>
        pluginConfig: ...

从包含的文件禁用插件

global:
  dynamic:
    includes:
      - dynamic-plugins.default.yaml
    plugins:
      - package: <some imported plugins listed in dynamic-plugins.default.yaml>
        disabled: true

从包含的文件启用插件

global:
  dynamic:
    includes:
      - dynamic-plugins.default.yaml
    plugins:
      - package: <some imported plugins listed in dynamic-plugins.custom.yaml>
        disabled: false

启用在所含文件中禁用的插件

global:
  dynamic:
    includes:
      - dynamic-plugins.default.yaml
    plugins:
      - package: <some imported plugins listed in dynamic-plugins.custom.yaml>
        disabled: false

2.3. 使用 Helm Chart 安装外部动态插件

NPM registry 包含可用于演示目的的外部动态插件。例如,以下社区插件在 NPMJS 存储库中的 janus-idp 组织中提供:

  • 通知(前端和后端)
  • Kubernetes 操作(scaffolder 操作)

要安装 Notifications 和 Kubernetes 操作插件,请将它们包含在 global.dynamic.plugins 列表中的 Helm Chart 值中,如下例所示:

global:
  dynamic:
    plugins:
      - package: '@janus-idp/plugin-notifications-backend-dynamic@1.3.6'
        # Integrity can be found at https://registry.npmjs.org/@janus-idp/plugin-notifications-backend-dynamic
        integrity: 'sha512-Qd8pniy1yRx+x7LnwjzQ6k9zP+C1yex24MaCcx7dGDPT/XbTokwoSZr4baSSn8jUA6P45NUUevu1d629mG4JGQ=='
      - package: '@janus-idp/plugin-notifications@1.1.12'
        # https://registry.npmjs.org/@janus-idp/plugin-notifications
        integrity: 'sha512-GCdEuHRQek3ay428C8C4wWgxjNpNwCXgIdFbUUFGCLLkBFSaOEw+XaBvWaBGtQ5BLgE3jQEUxa+422uzSYC5oQ=='
        pluginConfig:
          dynamicPlugins:
            frontend:
              janus-idp.backstage-plugin-notifications:
                appIcons:
                  - name: notificationsIcon
                    module: NotificationsPlugin
                    importName: NotificationsActiveIcon
                dynamicRoutes:
                  - path: /notifications
                    importName: NotificationsPage
                    module: NotificationsPlugin
                    menuItem:
                      icon: notificationsIcon
                      text: Notifications
                    config:
                      pollingIntervalMs: 5000
      - package: '@janus-idp/backstage-scaffolder-backend-module-kubernetes-dynamic@1.3.5'
        # https://registry.npmjs.org/@janus-idp/backstage-scaffolder-backend-module-kubernetes-dynamic
        integrity: 'sha512-19ie+FM3QHxWYPyYzE0uNdI5K8M4vGZ0SPeeTw85XPROY1DrIY7rMm2G0XT85L0ZmntHVwc9qW+SbHolPg/qRA=='
          proxy:
            endpoints:
              /explore-backend-completed:
                target: 'http://localhost:7017'
      - package: '@dfatwork-pkgs/search-backend-module-explore-wrapped-dynamic@0.1.3-next.1'
        # https://registry.npmjs.org/@dfatwork-pkgs/search-backend-module-explore-wrapped-dynamic
        integrity: 'sha512-mv6LS8UOve+eumoMCVypGcd7b/L36lH2z11tGKVrt+m65VzQI4FgAJr9kNCrjUZPMyh36KVGIjYqsu9+kgzH5A=='
      - package: '@dfatwork-pkgs/plugin-catalog-backend-module-test-dynamic@0.0.0'
        # https://registry.npmjs.org/@dfatwork-pkgs/plugin-catalog-backend-module-test-dynamic
        integrity: 'sha512-YsrZMThxJk7cYJU9FtAcsTCx9lCChpytK254TfGb3iMAYQyVcZnr5AA/AU+hezFnXLsr6gj8PP7z/mCZieuuDA=='

第 3 章 在 air-gapped 环境中安装动态插件

您可以通过设置自定义 NPM registry,在 air-gapped 环境中安装外部插件。

您可以使用 Helm Chart 为动态插件软件包配置 NPM registry URL 和身份验证信息。对于通过 npm pack 获取的动态插件软件包,您可以使用 .npmrc 文件。

使用 Helm Chart,使用以下内容创建名为 dynamic-plugins-npmrc 的 secret,将 .npmrc 文件添加到 NPM registry 中:

apiVersion: v1
kind: Secret
metadata:
  name: dynamic-plugins-npmrc
type: Opaque
stringData:
  .npmrc: |
    registry=<registry-url>
    //<registry-url>:_authToken=<auth-token>
          ...

第 4 章 查看已安装的插件

使用 Dynamic Plugins Info 前端插件,您可以查看当前安装在 Red Hat Developer Hub 应用程序中的插件。此插件默认是启用的。

流程

  1. 打开 Developer Hub 应用程序,然后点 Administration
  2. 转至 Plugins 选项卡,以查看已安装的插件和相关信息的列表。

法律通告

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部