7.3. 高级 Clair 配置
7.3.1. 非受管 Clair 配置 复制链接链接已复制到粘贴板!
使用 Red Hat Quay 3.7,用户可以在 Red Hat Quay OpenShift Container Platform Operator 上运行非受管 Clair 配置。此功能允许用户创建非受管 Clair 数据库,或在没有非受管数据库的情况下运行其自定义 Clair 配置。
7.3.1.1. 取消管理 Clair 数据库 复制链接链接已复制到粘贴板!
非受管 Clair 数据库允许 Red Hat Quay Operator 在 异地复制环境中工作,其中 Operator 的多个实例必须与同一数据库通信。当用户需要在集群外存在的高可用性(HA)Clair 数据库时,也可以使用非受管 Clair 数据库。
流程
在 Quay Operator 中,将 QuayRegistry 自定义资源的
clairpostgres
组件设置为非受管状态:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
7.3.1.2. 配置自定义 Clair 数据库 复制链接链接已复制到粘贴板!
Red Hat Quay Operator for OpenShift Container Platform 允许用户通过编辑 configBundleSecret
参数来提供自己的 Clair 配置。
流程
创建包含
clair-config.yaml
的 Quay 配置捆绑包 secret:oc create secret generic --from-file config.yaml=./config.yaml --from-file extra_ca_cert_rds-ca-2019-root.pem=./rds-ca-2019-root.pem --from-file clair-config.yaml=./clair-config.yaml --from-file ssl.cert=./ssl.cert --from-file ssl.key=./ssl.key config-bundle-secret
$ oc create secret generic --from-file config.yaml=./config.yaml --from-file extra_ca_cert_rds-ca-2019-root.pem=./rds-ca-2019-root.pem --from-file clair-config.yaml=./clair-config.yaml --from-file ssl.cert=./ssl.cert --from-file ssl.key=./ssl.key config-bundle-secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow clair-config.yaml
配置示例:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意-
数据库证书挂载到
clair-config.yaml
中的 Clair 应用程序 pod 的/run/certs/rds-ca-2019-root.pem
下。在配置clair-config.yaml
时必须指定它。 -
Clair on OpenShift config 中包括了一个
clair-config.yaml
示例。
-
数据库证书挂载到
将
clair-config.yaml
添加到捆绑包 secret 中,名为configBundleSecret
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意更新后,提供的
clair-config.yaml
会挂载到 Clair pod。未提供的任何字段都将使用 Clair 配置模块自动填充默认值。
在正确配置后,Clair 应用 pod 应该返回 Ready
状态。
7.3.2. 使用 受管 数据库运行自定义 Clair 配置 复制链接链接已复制到粘贴板!
在某些情况下,用户可能希望使用 受管
数据库运行自定义 Clair 配置。这在以下情况中很有用:
- 当用户要禁用更新器时。
当用户在 air-gapped 环境中运行时。
注意-
如果您在 air-gapped 环境中运行 Quay,则
clair-config.yaml
的airgap
参数必须设置为true
。 - 如果您在 air-gapped 环境中运行 Quay,您应该禁用所有更新器。
-
如果您在 air-gapped 环境中运行 Quay,则
当 clair
posts 设置为 managed
时,请使用"配置自定义 Clair 数据库"中的步骤来配置数据库。
有关在 air-gapped 环境中运行 Clair 的更多信息,请参阅在 air-gapped OpenShift 集群中配置 Clair 数据库的访问权限。