Ensure updated lb sgs is used on the CRD
When syncing the load balancer security group, the klb crd is updated with the new security groups, but the event proceeds to be handled with outdated sgs. This commit ensures the klb crd resource is updated. Change-Id: Ia7064bc4b599b8dc05572717f4d80acc03583c20
This commit is contained in:
parent
ffc0af30c6
commit
6a5f654739
@ -207,10 +207,6 @@ class KuryrLoadBalancerHandler(k8s_base.ResourceEventHandler):
|
||||
lb = klb_crd['status'].get('loadbalancer')
|
||||
svc_name = klb_crd['metadata']['name']
|
||||
svc_namespace = klb_crd['metadata']['namespace']
|
||||
if not lb:
|
||||
LOG.debug("No LB created. Skipping lb %s sg sync.",
|
||||
svc_name)
|
||||
return
|
||||
k8s = clients.get_kubernetes_client()
|
||||
try:
|
||||
service = k8s.get(
|
||||
@ -225,6 +221,8 @@ class KuryrLoadBalancerHandler(k8s_base.ResourceEventHandler):
|
||||
|
||||
project_id = self._drv_svc_project.get_project(service)
|
||||
lb_sgs = self._drv_sg.get_security_groups(service, project_id)
|
||||
lb['security_groups'] = lb_sgs
|
||||
|
||||
try:
|
||||
k8s.patch_crd('status/loadbalancer',
|
||||
klb_crd['metadata']['selfLink'],
|
||||
@ -236,10 +234,12 @@ class KuryrLoadBalancerHandler(k8s_base.ResourceEventHandler):
|
||||
' %s', svc_name)
|
||||
raise
|
||||
|
||||
return klb_crd
|
||||
|
||||
def _add_new_members(self, loadbalancer_crd):
|
||||
changed = False
|
||||
|
||||
self._sync_lbaas_sgs(loadbalancer_crd)
|
||||
if loadbalancer_crd['status'].get('loadbalancer'):
|
||||
loadbalancer_crd = self._sync_lbaas_sgs(loadbalancer_crd)
|
||||
|
||||
lsnr_by_id = {l['id']: l for l in loadbalancer_crd['status'].get(
|
||||
'listeners', [])}
|
||||
|
Loading…
Reference in New Issue
Block a user