2.3. 配置 Fuse Online 以启用 API 的 3scale 发现
如果创建 API 供应商集成,您可能需要在 Red Hat 3scale 中启用该集成的 API 发现。默认行为是 API 不会公开在 3scale 中自动发现。启用发现时,必须为 3scale 用户界面提供 URL。
要在安装 Fuse Online 前配置 Fuse Online 以启用 3scale 发现 API,请参阅 配置 Fuse Online 的自定义资源属性的描述。
安装后,您可以通过更新复合自定义资源来启用发现。执行此操作的说明位于本主题中。当您启用发现时,它只适用于在更新资源时连接到的 OpenShift 项目。
打开 3scale 服务发现意味着:
默认行为是 3scale 发布 API 供应商集成。当 3scale 发布 API 供应商集成时:
- Fuse Online 不提供运行 API 提供程序集成的外部 URL。
- API 只能通过 3scale 访问。3scale 中的配置需要公开端点。详情请参阅 Red Hat 3scale API Management, 服务发现。
- API 供应商集成的创建者可以为该集成禁用 3scale 发现。换句话说,每个 API 供应商集成创建者可以选择该集成的 API 是否可以被发现。
先决条件
- Fuse Online 安装在 OCP 现场。
-
已安装
oc
客户端工具,并连接到安装了 Fuse Online 的 OCP 集群。 - 您有权在要启用 API 发现的项目中安装 Fuse Online。
流程
使用有权安装 Fuse Online 的帐户登录到 OpenShift。例如:
oc login -u developer -p developer
切换到运行 Fuse Online 的 OpenShift 项目。您只能为此项目启用发现。例如:
oc project my-fuse-online-project
编辑
syndesis
自定义资源:调用以下命令,这通常会在编辑器中打开资源:
oc edit syndesis
通过将
managementUrlFor3scale
设置为 3scale 用户界面的 URL 来编辑资源。结果类似如下:spec: components: server: features: managementUrlFor3scale: https://3scale-admin.apps.mycluster.com
spec: components: server: features: managementUrlFor3scale: https://3scale-admin.apps.mycluster.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 保存资源。
可选的。要确认为您切换到的项目打开发现,请调用以下命令:
oc describe dc/syndesis-server
打开发现后,此命令的输出会显示
OPENSHIFT_MANAGEMENT_URL_FOR3SCALE
环境变量设置为您在自定义资源中指定的 URL。
结果
对 syndesis
自定义资源的改变会触发 syndesis-operator
(负责安装 Fuse Online)以重新部署 syndesis-server
。在您切换到的 OpenShift 项目中,新的默认行为是公开 API 用于发现 3scale。
不要编辑 syndesis-server DeploymentConfig
对象来设置 OPENSHIFT_MANAGEMENT_URL_FOR3SCALE
环境变量。这不起作用,因为 syndesis-operator
恢复了您的更改。
确保仅部署 Fuse Online,并且始终根据复合自定义资源部署。
syndesis
-operator