2.3. 升级 3scale 镜像
本节论述了升级 3scale 镜像所需的步骤。
2.3.1. 流程
对
amp-system
镜像流进行补丁:要修补
amp-system
镜像流,您需要考虑用于 3scale 部署的数据库。- 如果 3scale 使用 Oracle 数据库部署,请执行以下步骤以使用 Oracle 数据库构建系统镜像 :1、2、4、8 和 9。
如果数据库不同,使用以下命令:
$ oc patch imagestream/amp-system --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "AMP system 2.7"}, "from": { "kind": "DockerImage", "name": "registry.redhat.io/3scale-amp2/system-rhel7:3scale2.7"}, "name": "2.7", "referencePolicy": {"type": "Source"}}}]' $ oc patch imagestream/amp-system --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "AMP system (latest)"}, "from": { "kind": "ImageStreamTag", "name": "2.7"}, "name": "latest", "referencePolicy": {"type": "Source"}}}]'
这会触发
system-app
、system-sphinx
和system-sidekiq
DeploymentConfig 的重新部署。等待它们重新部署、对应的新容器集就绪,并且旧容器集终止。
对
amp-apicast
镜像流进行补丁:$ oc patch imagestream/amp-apicast --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "AMP APIcast 2.7"}, "from": { "kind": "DockerImage", "name": "registry.redhat.io/3scale-amp2/apicast-gateway-rhel7:3scale2.7"}, "name": "2.7", "referencePolicy": {"type": "Source"}}}]' $ oc patch imagestream/amp-apicast --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "AMP APIcast (latest)"}, "from": { "kind": "ImageStreamTag", "name": "2.7"}, "name": "latest", "referencePolicy": {"type": "Source"}}}]'
这会触发
apicast-production
和apicast-staging
DeploymentConfig 的重新部署。等待它们重新部署、对应的新容器集就绪,并且旧容器集终止。对
amp-backend
镜像流进行补丁:$ oc patch imagestream/amp-backend --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "AMP Backend 2.7"}, "from": { "kind": "DockerImage", "name": "registry.redhat.io/3scale-amp2/backend-rhel7:3scale2.7"}, "name": "2.7", "referencePolicy": {"type": "Source"}}}]' $ oc patch imagestream/amp-backend --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "AMP Backend (latest)"}, "from": { "kind": "ImageStreamTag", "name": "2.7"}, "name": "latest", "referencePolicy": {"type": "Source"}}}]'
这会触发
backend-listener
、backend-worker
和backend-cron
DeploymentConfig 的重新部署。等待它们重新部署、对应的新容器集就绪,并且旧容器集终止。对
amp-zync
镜像流进行补丁:$ oc patch imagestream/amp-zync --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "AMP Zync 2.7"}, "from": { "kind": "DockerImage", "name": "registry.redhat.io/3scale-amp2/zync-rhel7:3scale2.7"}, "name": "2.7", "referencePolicy": {"type": "Source"}}}]' $ oc patch imagestream/amp-zync --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "AMP Zync (latest)"}, "from": { "kind": "ImageStreamTag", "name": "2.7"}, "name": "latest", "referencePolicy": {"type": "Source"}}}]'
-
这会触发
zync
和zync-que
DeploymentConfig 的重新部署。等待它们重新部署、对应的新容器集就绪,并且旧容器集终止。
-
这会触发
对
system-memcached
ImageStream 进行补丁:$ oc patch imagestream/system-memcached --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "System 2.7 Memcached"}, "from": { "kind": "DockerImage", "name": "registry.redhat.io/3scale-amp2/memcached-rhel7:3scale2.7"}, "name": "2.7", "referencePolicy": {"type": "Source"}}}]' $ oc patch imagestream/system-memcached --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "System Memcached (latest)"}, "from": { "kind": "ImageStreamTag", "name": "2.7"}, "name": "latest", "referencePolicy": {"type": "Source"}}}]'
这会触发
system-memcache
DeploymentConfig 的重新部署。等待它们重新部署、对应的新容器集就绪,并且旧容器集终止。对
zync-database-postgresql
镜像流进行补丁:$ oc patch imagestream/zync-database-postgresql --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "Zync 2.7 PostgreSQL"}, "from": { "kind": "DockerImage", "name": "registry.redhat.io/rhscl/postgresql-10-rhel7"}, "name": "2.7", "referencePolicy": {"type": "Source"}}}]' $ oc patch imagestream/zync-database-postgresql --type=json -p '[{"op": "add", "path": "/spec/tags/-", "value": {"annotations": {"openshift.io/display-name": "Zync PostgreSQL (latest)"}, "from": { "kind": "ImageStreamTag", "name": "2.7"}, "name": "latest", "referencePolicy": {"type": "Source"}}}]'
这个补丁更新了
zync-database-postgresql
镜像流,使其包含 2.7 标签。您可以使用这个命令确认已创建了 2.7 标签:$ oc get is zync-database-postgresql
-
如果镜像上有新的更新,此补丁还可能触发
zync-database
DeploymentConfig 的重新部署。如果发生这种情况,请等待新容器集重新部署并就绪,并且旧容器集终止。
如果 3scale 2.6 安装中存在一个或多个 DeploymentConfig,请点适用 DeploymentConfig 的链接来获取如何继续的更多信息:
更新可见的发行版本:
$ oc set env dc/system-app AMP_RELEASE=2.7
这会触发
system-app
DeploymentConfig 的重新部署。等待它被执行,并且对应的新容器集就绪并且旧容器集终止。验证 DeploymentConfig 的所有镜像 URL 是否包含新镜像 registry URL,并在每个 URL 末尾添加一个哈希:
$ THREESCALE_DC_NAMES="apicast-production apicast-staging backend-cron backend-listener backend-redis backend-worker system-app system-memcache system-mysql system-redis system-sidekiq system-sphinx zync zync-database" for component in ${THREESCALE_DC_NAMES}; do echo -n "${component} image: " && oc get dc $component -o json | jq .spec.template.spec.containers[0].image ; done