2.2. 在 OpenShift 4.x 服务器上安装 Fuse 镜像流和模板
OpenShift Container Platform 4.x 使用 Samples Operator (在 OpenShift 命名空间中运行),安装和更新基于 Red Hat Enterprise Linux (RHEL)的 OpenShift Container Platform 镜像流和模板。在 OpenShift 镜像流和模板上安装 Fuse:
- 重新配置 Samples Operator
将 Fuse 镜像流和模板添加到
Skipped Imagestreams 和 Skipped Templates
字段中。- 跳过的 Imagestreams:位于 Samples Operator 清单中的 Imagestreams,但集群管理员希望 Operator 忽略或不管理。
- 跳过的模板:位于 Samples Operator 清单中的模板,但集群管理员希望 Operator 忽略或不予管理。
先决条件
- 您可以访问 OpenShift 服务器。
-
您已将身份验证配置为
registry.redhat.io
。 - 另外,如果您要在安装 OpenShift 仪表板后在 OpenShift 仪表板中看到 Fuse 模板,您必须首先安装服务目录和模板服务代理,如 OpenShift 文档https://docs.openshift.com/container-platform/4.1/applications/service_brokers/installing-service-catalog.html所述。
流程
- 启动 OpenShift 4 服务器。
以管理员身份登录 OpenShift 服务器。
oc login -u system:admin
验证您是否使用您为其创建 docker-registry secret 的项目。
oc project openshift
查看 Samples operator 的当前配置。
oc get configs.samples.operator.openshift.io -n openshift-cluster-samples-operator -o yaml
配置 Samples operator 以忽略添加的 fuse 模板和镜像流。
oc edit configs.samples.operator.openshift.io -n openshift-cluster-samples-operator
添加 Fuse imagestreams Skipped Imagestreams 部分,并将 Fuse 和 Spring Boot 2 模板添加到 Skipped Templates 部分。
[...] spec: architectures: - x86_64 managementState: Managed skippedImagestreams: - fuse-console-rhel8 - fuse-eap-openshift-jdk8-rhel7 - fuse-eap-openshift-jdk11-rhel8 - fuse-java-openshift-rhel8 - fuse-java-openshift-jdk11-rhel8 - fuse-karaf-openshift-rhel8 - fuse-apicurito-generator-rhel8 - fuse-apicurito-rhel8 skippedTemplates: - s2i-fuse79-eap-camel-amq - s2i-fuse79-eap-camel-cdi - s2i-fuse79-eap-camel-cxf-jaxrs - s2i-fuse79-eap-camel-cxf-jaxws - s2i-fuse79-karaf-camel-amq - s2i-fuse79-karaf-camel-log - s2i-fuse79-karaf-camel-rest-sql - s2i-fuse79-karaf-cxf-rest - s2i-fuse79-spring-boot-2-camel-amq - s2i-fuse79-spring-boot-2-camel-config - s2i-fuse79-spring-boot-2-camel-drools - s2i-fuse79-spring-boot-2-camel-infinispan - s2i-fuse79-spring-boot-2-camel-rest-3scale - s2i-fuse79-spring-boot-2-camel-rest-sql - s2i-fuse79-spring-boot-2-camel - s2i-fuse79-spring-boot-2-camel-xa - s2i-fuse79-spring-boot-2-camel-xml - s2i-fuse79-spring-boot-2-cxf-jaxrs - s2i-fuse79-spring-boot-2-cxf-jaxws - s2i-fuse79-spring-boot-2-cxf-jaxrs-xml - s2i-fuse79-spring-boot-2-cxf-jaxws-xml
在 OpenShift 镜像流上安装 Fuse。
BASEURL=https://raw.githubusercontent.com/jboss-fuse/application-templates/application-templates-2.1.0.fuse-sb2-790047-redhat-00005 oc create -n openshift -f ${BASEURL}/fis-image-streams.json
注意如果显示错误,并显示消息 "Error from server (AlreadyExists): imagestreams.image.openshift.io <imagestreamname> already exists",请使用以下命令将现有镜像流替换为最新的镜像流。
oc replace --force -n openshift -f ${BASEURL}/fis-image-streams.json
在 OpenShift 快速启动模板上安装 Fuse:
for template in eap-camel-amq-template.json \ eap-camel-cdi-template.json \ eap-camel-cxf-jaxrs-template.json \ eap-camel-cxf-jaxws-template.json \ karaf-camel-amq-template.json \ karaf-camel-log-template.json \ karaf-camel-rest-sql-template.json \ karaf-cxf-rest-template.json ; do oc create -n openshift -f \ https://raw.githubusercontent.com/jboss-fuse/application-templates/application-templates-2.1.0.fuse-sb2-790047-redhat-00005/quickstarts/${template} done
安装 Spring Boot 2 Quickstart 模板:
for template in spring-boot-2-camel-amq-template.json \ spring-boot-2-camel-config-template.json \ spring-boot-2-camel-drools-template.json \ spring-boot-2-camel-infinispan-template.json \ spring-boot-2-camel-rest-3scale-template.json \ spring-boot-2-camel-rest-sql-template.json \ spring-boot-2-camel-template.json \ spring-boot-2-camel-xa-template.json \ spring-boot-2-camel-xml-template.json \ spring-boot-2-cxf-jaxrs-template.json \ spring-boot-2-cxf-jaxws-template.json \ spring-boot-2-cxf-jaxrs-xml-template.json \ spring-boot-2-cxf-jaxws-xml-template.json ; do oc create -n openshift -f \ https://raw.githubusercontent.com/jboss-fuse/application-templates/application-templates-2.1.0.fuse-sb2-790047-redhat-00005/quickstarts/${template} done
(可选) 查看 OpenShift 模板上安装的 Fuse:
oc get template -n openshift