8.2. 为远程 Git 存储库添加身份验证详情
director Operator 会将呈现的 Ansible playbook 存储到远程 Git 存储库,并使用此存储库跟踪 overcloud 配置的更改。您可以使用支持 SSH 身份验证的任何 Git 存储库。您必须将 Git 存储库的详细信息作为名为 git-secret
的 OpenShift Secret 资源提供。
前提条件
- 确保 OpenShift Container Platform 集群正常运行,并且已正确安装了 director Operator。
-
确保已在工作站上安装了
oc
命令行工具。 - 为 director Operator 准备远程 Git 存储库,以存储 overcloud 生成的配置。
-
准备 SSH 密钥对。将公钥上传到 Git 存储库,并保留相应的私钥,以添加到
git-secret
Secret 资源中。
流程
创建 Secret 资源:
oc create secret generic git-secret -n openstack --from-file=git_ssh_identity=<path_to_private_SSH_key> --from-literal=git_url=<git_server_URL>
$ oc create secret generic git-secret -n openstack --from-file=git_ssh_identity=<path_to_private_SSH_key> --from-literal=git_url=<git_server_URL>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow git-secret
Secret 资源包含两个键值对:git_ssh_identity
-
用于访问 Git 存储库的私钥。
--from-file
选项存储 SSH 私钥文件的内容。 git_url
-
用于存储配置的 git 存储库的 SSH URL。
--from-literal
选项存储您输入的 URL 作为这个密钥。
验证
查看 Secret 资源:
oc get secret/git-secret -n openstack
$ oc get secret/git-secret -n openstack
Copy to Clipboard Copied! Toggle word wrap Toggle overflow