Merge "Add config option to enable Kubernetes Event creation."
This commit is contained in:
commit
d32122a5d1
@ -203,6 +203,14 @@ k8s_opts = [
|
||||
help=_("The prefix to use for additional vifs created by "
|
||||
" multi_vif drivers"),
|
||||
default='eth'),
|
||||
cfg.BoolOpt('use_events',
|
||||
help=_('Use Kubernetes Events objects to indicate status of '
|
||||
'Kuryr created OpenStack objects like networking for '
|
||||
'pods (Neutron ports) or services (Octavia '
|
||||
'loadbalancers). It might have impact on performance '
|
||||
'on Kubernetes cluster, since all objects (so the '
|
||||
'Event objects too) are stored on etcd.'),
|
||||
default=True),
|
||||
]
|
||||
|
||||
neutron_defaults = [
|
||||
|
@ -51,6 +51,7 @@ class K8sClient(object):
|
||||
token_file = config.CONF.kubernetes.token_file
|
||||
self.token = None
|
||||
self.cert = (None, None)
|
||||
self.are_events_enabled = config.CONF.kubernetes.use_events
|
||||
|
||||
# Setting higher numbers regarding connection pools as we're running
|
||||
# with max of 1000 green threads.
|
||||
@ -450,6 +451,9 @@ class K8sClient(object):
|
||||
|
||||
def add_event(self, resource, reason, message, type_='Normal'):
|
||||
"""Create an Event object for the provided resource."""
|
||||
if not self.are_events_enabled:
|
||||
return {}
|
||||
|
||||
involved_object = {'apiVersion': resource['apiVersion'],
|
||||
'kind': resource['kind'],
|
||||
'name': resource['metadata']['name'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user