8.2.3. 配置对断开连接的 OpenShift Container Platform 集群中的 Clair 数据库的访问
要为自助管理的部署配置对断开连接的 OpenShift Container Platform 集群中的 Clair 数据库的访问,您可以确定数据库服务、转发数据库端口并更新 Clair config.yaml 文件以使用 localhost。这可让您使用 clairctl 工具将更新程序捆绑包导入到数据库中。
先决条件
-
您已安装了
clairctl命令行工具工具。 - 您已部署了 Clair。
-
disable_updaters和airgap参数在 Clairconfig.yaml文件中被设置为True。 - 您已从可访问互联网的 Clair 实例导出了更新程序捆绑包。
流程
使用
ocCLI 工具确定您的 Clair 数据库服务,例如:$ oc get svc -n quay-enterprise输出示例
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE example-registry-clair-app ClusterIP 172.30.224.93 <none> 80/TCP,8089/TCP 4d21h example-registry-clair-postgres ClusterIP 172.30.246.88 <none> 5432/TCP 4d21h ...转发 Clair 数据库端口,使其可以从本地机器访问。例如:
$ oc port-forward -n quay-enterprise service/example-registry-clair-postgres 5432:5432更新 Clair
config.yaml文件,例如:indexer: connstring: host=localhost port=5432 dbname=postgres user=postgres password=postgres sslmode=disable layer_scan_concurrency: 5 migrations: true scanlock_retry: 10 airgap: true scanner: repo: rhel-repository-scanner: repo2cpe_mapping_file: /data/repository-to-cpe.json package: rhel_containerscanner: name2repos_mapping_file: /data/container-name-repos-map.json其中:
connstring::指定数据库的连接字符串。rhel-repository-scanner::指定存储库扫描程序配置。rhel_containerscanner::指定容器扫描程序配置。