From 733a89dea2a92661e07f626d174d47565bf49dc8 Mon Sep 17 00:00:00 2001 From: Daniel Jiang Date: Thu, 26 Jul 2018 16:02:22 +0800 Subject: [PATCH] Enable configuring the interval of clair updaters To mitigate the impact we saw in the updater issues in clair, this commit enable configuring the interval, include disabling the updaters of clair. --- make/common/templates/clair/config.yaml | 2 +- make/harbor.cfg | 7 +++---- make/prepare | 4 +++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/make/common/templates/clair/config.yaml b/make/common/templates/clair/config.yaml index aaca46bc2..151901251 100644 --- a/make/common/templates/clair/config.yaml +++ b/make/common/templates/clair/config.yaml @@ -16,7 +16,7 @@ clair: # Deadline before an API request will respond with a 503 timeout: 300s updater: - interval: 12h + interval: ${interval}h notifier: attempts: 3 diff --git a/make/harbor.cfg b/make/harbor.cfg index 1dbfd826a..b226a5572 100644 --- a/make/harbor.cfg +++ b/make/harbor.cfg @@ -148,20 +148,19 @@ redis_url = redis:6379 #Clair DB host address. Only change it when using an exteral DB. clair_db_host = postgresql - #The password of the Clair's postgres database. Only effective when Harbor is deployed with Clair. #Please update it before deployment. Subsequent update will cause Clair's API server and Harbor unable to access Clair's database. clair_db_password = root123 - #Clair DB connect port clair_db_port = 5432 - #Clair DB username clair_db_username = postgres - #Clair default database clair_db = postgres +#The interval of clair updaters, the unit is hour, set to 0 to disable the updaters. +clair_updaters_interval = 12 + ##########End of Clair DB configuration############ #The following attributes only need to be set when auth mode is uaa_auth diff --git a/make/prepare b/make/prepare index 86cbe1e22..c24688f15 100755 --- a/make/prepare +++ b/make/prepare @@ -270,6 +270,7 @@ clair_db_host = rcp.get("configuration", "clair_db_host") clair_db_port = rcp.get("configuration", "clair_db_port") clair_db_username = rcp.get("configuration", "clair_db_username") clair_db = rcp.get("configuration", "clair_db") +clair_updaters_interval = rcp.get("configuration", "clair_updaters_interval") uaa_endpoint = rcp.get("configuration", "uaa_endpoint") uaa_clientid = rcp.get("configuration", "uaa_clientid") @@ -641,7 +642,8 @@ if args.clair_mode: username = clair_db_username, host = clair_db_host, port = clair_db_port, - dbname = clair_db) + dbname = clair_db, + interval = clair_updaters_interval) # config http proxy for Clair http_proxy = rcp.get("configuration", "http_proxy").strip()