第 5 章 使用命令行和 API 在 OpenShift 上配置 Quay

部署后,您可以通过编辑 Quay 配置捆绑包 secret spec.configBundleSecret 配置 Quay 应用程序,您也可以更改 QuayRegistry 资源的 spec.components 对象中的组件的受管状态。

Operator 不会监视 spec.configBundleSecret 资源是否有更改,因此建议对新的 Secret 资源进行配置更改,并且 spec.configBundleSecret 字段已更新,以反映更改。如果与新配置存在问题,则简单地将 spec.configBundleSecret 的值恢复到旧的 Secret

更改配置的步骤涉及:

  1. 确定当前的端点和 secret
  2. 如果已在 OpenShift 上部署了 Red Hat Quay,请下载现有配置捆绑包
  3. 创建或更新 config.yaml 配置文件
  4. 装配 Quay 所需的任何 SSL 证书或服务所需的自定义 SSL 证书
  5. 使用配置文件和任何证书创建新配置捆绑包 secret
  6. 创建或更新 registry,引用新的配置捆绑包 secret,并指定任何覆盖来管理组件
  7. 监控部署以确保成功完成并且配置更改生效

另外,您可以使用配置编辑器 UI 来配置 Quay 应用,如 第 6 章 使用配置工具在 OpenShift 中重新配置 Quay 部分所述。

5.1. 确定 QuayRegistry 端点和 secret

您可以使用 oc describe quayregistryoc get quayregistry -o yaml 来检查 QuayRegistry 资源,以确定当前的端点和 secret:

$ oc get quayregistry example-registry -n quay-enterprise -o yaml

apiVersion: quay.redhat.com/v1
kind: QuayRegistry
metadata:
  ...
  name: example-registry
  namespace: quay-enterprise
  ...
spec:
  components:
  ...
  configBundleSecret: example-registry-quay-config-bundle-fjpnm
status:
  configEditorCredentialsSecret: example-registry-quay-config-editor-credentials-kk55dc7299
  configEditorEndpoint: https://example-registry-quay-config-editor-quay-enterprise.apps.docs.quayteam.org
  currentVersion: 3.6.0
  lastUpdated: 2021-09-21 11:18:13.285192787 +0000 UTC
  registryEndpoint: https://example-registry-quay-quay-enterprise.apps.docs.quayteam.org
  unhealthyComponents: {}

相关字段为:

  • registryEndpoint :registry的 URL,用于浏览器访问 registry UI,以及 registry API 端点
  • configBundleSecret: config bundle secret,其中包含 config.yaml 文件和任何 SSL 证书
  • configEditorEndpoint :配置编辑器工具的 URL,用于浏览器访问配置工具,以及配置 API
  • configEditorCredentialsSecret:包含用户名的 secret(通常是 quayconfig)以及配置编辑器工具的密码

要确定配置编辑器工具的用户名和密码:

  1. 检索 secret:

    $ oc get secret -n quay-enterprise example-registry-quay-config-editor-credentials-kk55dc7299 -o yaml
    
    apiVersion: v1
    data:
      password: SkZwQkVKTUN0a1BUZmp4dA==
      username: cXVheWNvbmZpZw==
    kind: Secret
  2. 解码用户名:

    $ echo 'cXVheWNvbmZpZw==' | base64 --decode
    
    quayconfig
  3. 解码密码:

    $ echo 'SkZwQkVKTUN0a1BUZmp4dA==' | base64 --decode
    
    JFpBEJMCtkPTfjxt