第 5 章 在 Red Hat Developer Hub 中自定义 Tech Radar 页面
在 Red Hat Developer Hub 中,不能使用 Helm Chart 中的动态插件功能启用 Tech Radar 页面。
与 Home page 自定义类似,基础技术 Radar URL 必须包含 /developer-hub/tech-radar
代理。您可以使用以下方法提供 Tech Radar 页面数据:
使用托管或 GitHub 或 GitLab 的 JSON 文件。要从 JSON 文件访问数据,您可以在
app-config.yaml
文件中添加以下代码:proxy: endpoints: # Other Proxies # customize developer hub instance '/developer-hub': target: <DOMAIN_URL> # i.e https://raw.githubusercontent.com/ pathRewrite: '^/api/proxy/developer-hub/tech-radar': <path to json file> # i.e /janus-idp/backstage-showcase/main/packages/app/public/tech-radar/data-default.json '^/api/proxy/developer-hub': <path to json file> # i.e /janus-idp/backstage-showcase/main/packages/app/public/homepage/data.json changeOrigin: true secure: true # Change to "false" in case of using self hosted cluster with a self-signed certificate headers: <HEADER_KEY>: <HEADER_VALUE> # optional and can be passed as needed i.e Authorization can be passed for private GitHub repo and PRIVATE-TOKEN can be passed for private GitLab repo
注意随着在用于
tech-radar
和homepage
快速访问代理的pathRewrites
之间重叠,则tech-radar
(^api/proxy/developer-hub/tech-radar
)的配置必须在主页
配置之前存在。有关在 Red Hat Developer Hub 中自定义 Home 页面的更多信息,请参阅 第 4 章 自定义 Red Hat Developer Hub 中的主页。
- 使用单独的服务,使用 API 以 JSON 格式提供 Tech Radar 数据。
先决条件
- 已使用 Helm Chart 安装 Red Hat Developer Hub。如需更多信息,请参阅 第 2 章 安装 Red Hat Developer Hub。
流程
将以下代码添加到
app-config-rhdh.yaml
文件中:proxy: endpoints: # Other Proxies '/developer-hub/tech-radar': target: ${TECHRADAR_DATA_URL} changeOrigin: true # Change to "false" in case of using self hosted cluster with a self-signed certificate secure: true
确保 API 请求调用以 JSON 格式返回响应。
将
TECHRADAR_DATA_URL'
定义为http://<SERVICE_NAME>/tech-radar
,例如http://rhdh-customization-provider/tech-radar
。注意您可以通过将其添加到
rhdh-secrets
或直接将其替换为自定义 ConfigMap 中的值来定义TECHRADAR_DATA_URL
。- 删除 Developer Hub Pod 以拉取更改。