2.2. 更新系统的 pre-hook pod
要添加升级所需的 post-migration 操作,您必须从系统中更新 pre-hook pod 命令。
获取当前的 MASTER_ACCESS_TOKEN 值:
$ MASTER_ACCESS_TOKEN=$(oc get secret system-seed -o json | jq -r .data.MASTER_ACCESS_TOKEN | base64 -d)
验证 MASTER_ACCESS_TOKEN 未为空,并且具有现有的值:
$ echo ${MASTER_ACCESS_TOKEN}
将
system-app
DeploymentConfig 的 pre-hook pod 命令更新至此发行版本所需的新命令:$ oc patch dc/system-app -p "{\"spec\":{\"strategy\":{\"rollingParams\":{\"pre\":{\"execNewPod\":{\"command\":[\"bash\",\"-c\",\"bundle exec rake boot openshift:deploy MASTER_ACCESS_TOKEN=\\\"${MASTER_ACCESS_TOKEN}\\\" && bundle exec rake services:create_backend_apis services:update_metric_owners proxy:update_proxy_rule_owners\"]}}}}}}"
验证 pre-hook pod 命令是否已更改为新值:
$ oc get dc system-app -o json | jq .spec.strategy.rollingParams.pre.execNewPod.command
以上命令的结果应该是:
[ "bash", "-c", "bundle exec rake boot openshift:deploy MASTER_ACCESS_TOKEN=\"<your-master-access-token>\" && bundle exec rake services:create_backend_apis services:update_metric_owners proxy:update_proxy_rule_owners" ]