6.3. 管理 Service Registry 环境变量
Service Registry Operator 管理最常见的 Service Registry 配置,但有一些选项还不支持它。如果 ApicurioRegistry
CR 中没有高级别配置选项,您可以使用环境变量来调整它。您可以通过在 spec.configuration.env
字段中直接设置 ApicurioRegistry
CR 中的环境变量来更新它们。然后,它们转发到 Service Registry 的 Deployment
资源。
流程
您可以使用 OpenShift Web 控制台或 CLI 管理 Service Registry 环境变量。
- OpenShift web 控制台
- 选择 Installed Operators 选项卡,然后选择 Red Hat Integration - Service Registry Operator。
-
在 Apicurio Registry 标签页中,为您的 Service Registry 部署选择
ApicurioRegistry
CR。 点 YAML 选项卡,然后根据需要编辑
spec.configuration.env
部分。以下示例演示了如何设置默认全局内容规则:apiVersion: registry.apicur.io/v1 kind: ApicurioRegistry metadata: name: example-apicurioregistry spec: configuration: # ... env: - name: REGISTRY_RULES_GLOBAL_VALIDITY value: FULL # One of: NONE, SYNTAX_ONLY, FULL - name: REGISTRY_RULES_GLOBAL_COMPATIBILITY value: FULL # One of: NONE, BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE
- OpenShift CLI
- 选择安装 Service Registry 的项目。
-
运行
oc get apicurioregistry
以获取ApicurioRegistry
CR 列表 -
在代表您要配置的 Service Registry 实例的 CR 上运行
oc edit apicurioregistry
。 在
spec.configuration.env
部分添加或修改环境变量。Service Registry Operator 可能会尝试设置已在
spec.configuration.env
字段中明确指定的环境变量。如果环境变量配置具有冲突的值,则 Service Registry Operator 设置的值具有优先权。您可以通过对该功能使用高级别配置或仅使用明确指定的环境变量来避免这种冲突。以下是冲突配置示例:
apiVersion: registry.apicur.io/v1 kind: ApicurioRegistry metadata: name: example-apicurioregistry spec: configuration: # ... ui: readOnly: true env: - name: REGISTRY_UI_FEATURES_READONLY value: false
此配置会导致 Service Registry web 控制台处于只读模式。