使用外部 GitLab Pages 配置 GitLab chart
本文档旨在说明如何配置此 Helm chart,使其与集群外部使用 Linux 软件包配置的 GitLab Pages 实例协同工作。 议题 418259 提议为 Linux 软件包实例搭配使用 Helm chart 的外部 GitLab Pages 添加文档。
要求
- 应使用外部对象存储,这是生产实例的推荐做法。
- Pages 与 GitLab Pages 交互所需的 32 字节 API 密钥的 Base64 编码形式。
已知限制
- 开箱即用不支持 GitLab Pages 访问控制。
配置外部 GitLab Pages 实例
-
使用 Linux 软件包安装极狐GitLab。
-
编辑 /etc/gitlab/gitlab.rb 文件,并将其内容替换为以下代码片段。请根据您的配置更新以下值:
ruby1roles ['pages_role'] 2 3# Root domain where Pages will be served. 4pages_external_url '<Pages root domain>' # Example: 'http://pages.example.io' 5 6# Information regarding GitLab instance 7gitlab_pages['gitlab_server'] = '<GitLab URL>' # Example: 'https://gitlab.example.com' 8gitlab_pages['api_secret_key'] = '<Base64 encoded form of API secret key>' -
运行 sudo gitlab-ctl reconfigure 以应用更改。
配置 chart
-
在对象存储中创建一个名为 gitlab-pages 的存储桶,用于存储 Pages 部署。
-
创建一个密钥 gitlab-pages-api-key,其值为 API 密钥的 Base64 编码形式。
shellkubectl create secret generic gitlab-pages-api-key --from-literal="shared_secret=<Base 64 encoded API Secret Key>" -
参考以下配置片段,并在您的 values 文件中添加必要条目。
yaml1global: 2 pages: 3 path: '/srv/gitlab/shared/pages' 4 host: <Pages root domain> 5 port: '80' # Set to 443 if Pages is served over HTTPS 6 https: false # Set to true if Pages is served over HTTPS 7 artifactsServer: true 8 objectStore: 9 enabled: true 10 bucket: 'gitlab-pages' 11 apiSecret: 12 secret: gitlab-pages-api-key 13 key: shared_secret 14 extraEnv: 15 PAGES_UPDATE_LEGACY_STORAGE: true # Bypass automatic disabling of disk storage通过将PAGES_UPDATE_LEGACY_STORAGE 环境变量设置为 true,会启用功能标志 pages_update_legacy_storage,该标志会将 Pages 部署到本地磁盘。当您迁移到对象存储时,请记得移除该变量。
-
使用此配置部署 chart。