Fix Namespace handling

With the handling of Namespaces now being
dependent on Pods creation, tempests tests
need to get updated to account for that.

Change-Id: Id0879f128ca8c057ea6ec540fec0e76d656e7b13
This commit is contained in:
Maysa Macedo 2021-10-11 10:06:35 +00:00
parent ddef1710fb
commit 774fc6bae0
4 changed files with 11 additions and 2 deletions

View File

@ -104,5 +104,8 @@ kuryr_k8s_opts = [
" number LB members"),
cfg.BoolOpt("enable_reconciliation", default=False,
help="Whether or not reconciliation is enabled"),
cfg.BoolOpt("trigger_namespace_upon_pod", default=False,
help="Whether or not Namespace should be handled upon Pod "
"creation"),
]

View File

@ -827,6 +827,8 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
def create_namespace(cls, name=None, labels=None,
wait_for_crd=True,
timeout_period=consts.NS_TIMEOUT):
if CONF.kuryr_kubernetes.trigger_namespace_upon_pod:
wait_for_crd = False
if not name:
name = data_utils.rand_name(prefix='kuryr-namespace')
namespace = cls.k8s_client.V1Namespace()

View File

@ -148,6 +148,9 @@ class TestNetworkPolicyScenario(base.BaseKuryrScenarioTest,
def test_ipblock_network_policy_allow_except(self):
namespace_name, namespace = self.create_namespace()
self.addCleanup(self.delete_namespace, namespace_name)
pod_name, pod = self.create_pod(namespace=namespace_name)
self.addCleanup(self.delete_pod, pod_name, pod,
namespace=namespace_name)
if CONF.kuryr_kubernetes.kuryrnetworks:
cidr = self.get_kuryr_network_crds(

View File

@ -55,6 +55,9 @@ class TestNamespaceScenario(base.BaseKuryrScenarioTest):
self.assertIn(namespace_name, existing_namespaces)
pod_name, pod = self.create_pod(labels={"app": 'pod-label'},
namespace=namespace_name)
subnet_name = 'ns/' + namespace_name + '-subnet'
kuryr_net_crd_name = 'ns-' + namespace_name
@ -82,8 +85,6 @@ class TestNamespaceScenario(base.BaseKuryrScenarioTest):
self.assertIn(kuryr_net_crd['spec']['netId'], net_id)
# Check namespace pod connectivity
pod_name, pod = self.create_pod(labels={"app": 'pod-label'},
namespace=namespace_name)
self.create_setup_for_service_test(namespace=namespace_name,
cleanup=False)
self.check_service_internal_connectivity(namespace=namespace_name,