Fix constant update of Listeners timeout

The listeners timeout are constantly updated with
Octavia default values, even if no annotation was
updated on the respective Service. The constant
execution of this task makes the Load Balancer
to be stuck with PENDING_UPDATE status. This commit
fixes the issue by ensuring the listener values
are only added to the CR once there was annotation
changes, also it enforces the default values of not
existence of the field to be the same.

Change-Id: Id93ac76550761398c853ebfd03ac2e59667e0e06
Closes-Bug: 1923605
This commit is contained in:
Maysa Macedo 2021-04-13 11:35:25 +00:00
parent 47c427deaa
commit f10003f67e
2 changed files with 8 additions and 6 deletions

View File

@ -567,8 +567,10 @@ class LBaaSv2Driver(base.LBaaSDriver):
lbaas = clients.get_loadbalancer_client()
response = lbaas.create_listener(**request)
listener['id'] = response.id
listener['timeout_client_data'] = response.timeout_client_data
listener['timeout_member_data'] = response.timeout_member_data
if timeout_cli:
listener['timeout_client_data'] = response.timeout_client_data
if timeout_mem:
listener['timeout_member_data'] = response.timeout_member_data
return listener
def _update_listener_acls(self, loadbalancer, listener_id, allowed_cidrs):

View File

@ -575,8 +575,8 @@ class KuryrLoadBalancerHandler(k8s_base.ResourceEventHandler):
def _add_new_listeners(self, loadbalancer_crd):
changed = False
lb_crd_spec_ports = loadbalancer_crd['spec'].get('ports')
spec_t_cli = loadbalancer_crd['spec'].get('timeout_client_data')
spec_t_mb = loadbalancer_crd['spec'].get('timeout_member_data')
spec_t_cli = loadbalancer_crd['spec'].get('timeout_client_data', 0)
spec_t_mb = loadbalancer_crd['spec'].get('timeout_member_data', 0)
if not lb_crd_spec_ports:
return changed
lbaas_spec_ports = sorted(lb_crd_spec_ports,
@ -589,8 +589,8 @@ class KuryrLoadBalancerHandler(k8s_base.ResourceEventHandler):
listener = []
for l in loadbalancer_crd['status'].get('listeners', []):
timeout_cli = l.get('timeout_client_data')
timeout_mb = l.get('timeout_member_data')
timeout_cli = l.get('timeout_client_data', 0)
timeout_mb = l.get('timeout_member_data', 0)
if l['port'] == port and l['protocol'] == protocol:
if timeout_cli == spec_t_cli and timeout_mb == spec_t_mb:
listener.append(l)