Fix pool population when namespace isolation is enforced
When creating a new KuryrNet CRD, a pool population is triggered,
but with the wrong security groups type, as Neutron expects
a Security group List instead of String on the port creation request.
Closes-bug:
@@ -64,7 +64,10 @@ class KuryrNetHandler(k8s_base.ResourceEventHandler):
# required
project_id = self._drv_project.get_project(namespace)
subnets = self._drv_subnets.get_namespace_subnet(namespace, subnet_id)
- sg_id = kuryrnet_crd['spec'].get('sgId', [])
+ sgs = []
+ sg_id = kuryrnet_crd['spec'].get('sgId')
+ if sg_id:
+ sgs.append(sg_id)
nodes = utils.get_nodes_ips()
# NOTE(ltomasbo): Patching the kuryrnet_crd here instead of after
@@ -83,7 +86,7 @@ class KuryrNetHandler(k8s_base.ResourceEventHandler):
node_ip)
try:
self._drv_vif_pool.populate_pool(node_ip, project_id, subnets,
- sg_id)
+ sgs)
except exceptions.ResourceNotReady:
# Ensure the repopulation is retriggered if the system was not
# yet ready to perform the repopulation actions
