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 服务器。
- 您已为 Red Hat Container Registry 配置身份验证。
- 另外,如果在安装 Fuse 模板后在 OpenShift 仪表板中可见,您必须首先安装服务目录和模板服务代理,如 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: - fis-java-openshift - fis-karaf-openshift - fuse7-console - fuse7-eap-openshift - fuse7-java-openshift - fuse7-karaf-openshift - jboss-fuse70-console - jboss-fuse70-eap-openshift - jboss-fuse70-java-openshift - jboss-fuse70-karaf-openshift - fuse-apicurito-generator - apicurito-ui skippedTemplates: - s2i-fuse78-eap-camel-amq - s2i-fuse78-eap-camel-cdi - s2i-fuse78-eap-camel-cxf-jaxrs - s2i-fuse78-eap-camel-cxf-jaxws - s2i-fuse78-karaf-camel-amq - s2i-fuse78-karaf-camel-log - s2i-fuse78-karaf-camel-rest-sql - s2i-fuse78-karaf-cxf-rest - s2i-fuse78-spring-boot-2-camel-amq - s2i-fuse78-spring-boot-2-camel-config - s2i-fuse78-spring-boot-2-camel-drools - s2i-fuse78-spring-boot-2-camel-infinispan - s2i-fuse78-spring-boot-2-camel-rest-3scale - s2i-fuse78-spring-boot-2-camel-rest-sql - s2i-fuse78-spring-boot-2-camel - s2i-fuse78-spring-boot-2-camel-xa - s2i-fuse78-spring-boot-2-camel-xml - s2i-fuse78-spring-boot-2-cxf-jaxrs - s2i-fuse78-spring-boot-2-cxf-jaxws - s2i-fuse78-spring-boot-2-cxf-jaxrs-xml - s2i-fuse78-spring-boot-2-cxf-jaxws-xml
在 OpenShift 镜像流上安装 Fuse。
BASEURL=https://raw.githubusercontent.com/jboss-fuse/application-templates/application-templates-2.1.0.fuse-sb2-780019-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 quickstart 模板上安装 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-780019-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-780019-redhat-00005/quickstarts/${template} done
(可选) 查看 OpenShift 模板上安装的 Fuse:
oc get template -n openshift