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.
This commit is contained in:
Daniel Jiang 2018-07-26 16:02:22 +08:00
parent c1e1779ac0
commit 733a89dea2
3 changed files with 7 additions and 6 deletions

View File

@ -16,7 +16,7 @@ clair:
# Deadline before an API request will respond with a 503 # Deadline before an API request will respond with a 503
timeout: 300s timeout: 300s
updater: updater:
interval: 12h interval: ${interval}h
notifier: notifier:
attempts: 3 attempts: 3

View File

@ -148,20 +148,19 @@ redis_url = redis:6379
#Clair DB host address. Only change it when using an exteral DB. #Clair DB host address. Only change it when using an exteral DB.
clair_db_host = postgresql clair_db_host = postgresql
#The password of the Clair's postgres database. Only effective when Harbor is deployed with Clair. #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. #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_password = root123
#Clair DB connect port #Clair DB connect port
clair_db_port = 5432 clair_db_port = 5432
#Clair DB username #Clair DB username
clair_db_username = postgres clair_db_username = postgres
#Clair default database #Clair default database
clair_db = postgres 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############ ##########End of Clair DB configuration############
#The following attributes only need to be set when auth mode is uaa_auth #The following attributes only need to be set when auth mode is uaa_auth

View File

@ -270,6 +270,7 @@ clair_db_host = rcp.get("configuration", "clair_db_host")
clair_db_port = rcp.get("configuration", "clair_db_port") clair_db_port = rcp.get("configuration", "clair_db_port")
clair_db_username = rcp.get("configuration", "clair_db_username") clair_db_username = rcp.get("configuration", "clair_db_username")
clair_db = rcp.get("configuration", "clair_db") clair_db = rcp.get("configuration", "clair_db")
clair_updaters_interval = rcp.get("configuration", "clair_updaters_interval")
uaa_endpoint = rcp.get("configuration", "uaa_endpoint") uaa_endpoint = rcp.get("configuration", "uaa_endpoint")
uaa_clientid = rcp.get("configuration", "uaa_clientid") uaa_clientid = rcp.get("configuration", "uaa_clientid")
@ -641,7 +642,8 @@ if args.clair_mode:
username = clair_db_username, username = clair_db_username,
host = clair_db_host, host = clair_db_host,
port = clair_db_port, port = clair_db_port,
dbname = clair_db) dbname = clair_db,
interval = clair_updaters_interval)
# config http proxy for Clair # config http proxy for Clair
http_proxy = rcp.get("configuration", "http_proxy").strip() http_proxy = rcp.get("configuration", "http_proxy").strip()