Make catalog-cache-expiration configurable

Expose catalog-cache-expiration which can be used to specify how
long catalogue entries will  be cached for. In addiontion inform
charms that receive notifications of endpoint changes what this
setting is.

Change-Id: I3ce72efc5bd96c987748f66a275f92941daa8fe5
This commit is contained in:
Liam Young 2020-09-29 15:59:38 +00:00
parent 6ba782f61d
commit 57b9d62aaf
8 changed files with 16 additions and 0 deletions

View File

@ -102,6 +102,10 @@ options:
type: int
default: 3600
description: Amount of time (in seconds) a token should remain valid.
catalog-cache-expiration:
type: int
default: 60
description: Amount of time (in seconds) the catalog should be cached for.
fernet-max-active-keys:
type: int
default: 3

View File

@ -201,6 +201,7 @@ class KeystoneContext(context.OSContextGenerator):
ctxt['debug'] = config('debug')
ctxt['verbose'] = config('verbose')
ctxt['token_expiration'] = config('token-expiration')
ctxt['catalog_cache_expiration'] = config('catalog-cache-expiration')
ctxt['identity_backend'] = config('identity-backend')
ctxt['assignment_backend'] = config('assignment-backend')

View File

@ -2211,6 +2211,7 @@ def send_id_service_notifications(data):
relation_set(
relation_id=rid,
relation_settings={
'catalog_ttl': config('catalog-cache-expiration'),
'ep_changed': json.dumps(changed, sort_keys=True)})

View File

@ -38,6 +38,7 @@ driver = sql
[os_inherit]
[catalog]
cache_time = {{ catalog_cache_expiration }}
driver = sql
[endpoint_filter]

View File

@ -38,6 +38,7 @@ driver = sql
[os_inherit]
[catalog]
cache_time = {{ catalog_cache_expiration }}
driver = sql
[endpoint_filter]

View File

@ -38,6 +38,7 @@ driver = sql
[os_inherit]
[catalog]
cache_time = {{ catalog_cache_expiration }}
driver = sql
[endpoint_filter]

View File

@ -36,6 +36,7 @@ driver = sql
driver = sql
[catalog]
cache_time = {{ catalog_cache_expiration }}
driver = sql
[endpoint_filter]

View File

@ -924,6 +924,7 @@ class TestKeystoneUtils(CharmTestCase):
call(
relation_id='identity-service:1',
relation_settings={
'catalog_ttl': 60,
'ep_changed':
('{"neutron": {"internal": '
'"http://neutron.demo.com:9696"}}')
@ -932,6 +933,7 @@ class TestKeystoneUtils(CharmTestCase):
call(
relation_id='identity-service:2',
relation_settings={
'catalog_ttl': 60,
'ep_changed':
('{"neutron": {"internal": '
'"http://neutron.demo.com:9696"},'
@ -948,6 +950,7 @@ class TestKeystoneUtils(CharmTestCase):
call(
relation_id='identity-service:1',
relation_settings={
'catalog_ttl': 60,
'ep_changed':
'{"neutron": {"internal": "http://demo.com"}}'
}
@ -955,6 +958,7 @@ class TestKeystoneUtils(CharmTestCase):
call(
relation_id='identity-service:2',
relation_settings={
'catalog_ttl': 60,
'ep_changed':
'{"neutron": {"internal": "http://demo.com"}}'
}
@ -973,6 +977,7 @@ class TestKeystoneUtils(CharmTestCase):
call(
relation_id='identity-service:1',
relation_settings={
'catalog_ttl': 60,
'ep_changed':
'{"neutron": {"internal": "http://demo.com"}}'
}
@ -980,6 +985,7 @@ class TestKeystoneUtils(CharmTestCase):
call(
relation_id='identity-service:2',
relation_settings={
'catalog_ttl': 60,
'ep_changed': (
'{"neutron": {"internal": "http://demo.com"}, '
'"placement": {"internal": "http://demo.com"}}'