aboutsummaryrefslogtreecommitdiffstats
path: root/functest_kubernetes
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2020-09-22 16:47:04 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2020-09-23 09:44:04 +0200
commitbfbe11dfc395913861a3ae85ea33015d1e1590c1 (patch)
tree861707a547c82721ce1b3a49888a0ecabef1380a /functest_kubernetes
parentc36d291064203df9af5d5ede4bd006b6d25b993e (diff)
Stop hardcoding ims- as generate_name
Change-Id: I3ea22a4050ff1eb609cffb61edc41c49fab44366 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 3a3bd294ea8101c22896d8601fe2723861f73124)
Diffstat (limited to 'functest_kubernetes')
-rw-r--r--functest_kubernetes/ims/ims.py3
-rw-r--r--functest_kubernetes/security/security.py9
2 files changed, 10 insertions, 2 deletions
diff --git a/functest_kubernetes/ims/ims.py b/functest_kubernetes/ims/ims.py
index a2d64314..30a4f343 100644
--- a/functest_kubernetes/ims/ims.py
+++ b/functest_kubernetes/ims/ims.py
@@ -38,6 +38,7 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
metadata_name = "env-vars"
test_image_name = "ollivier/clearwater-live-test:hunter"
test_container_name = "live-test"
+ ns_generate_name = "ims-"
__logger = logging.getLogger(__name__)
@@ -64,7 +65,7 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
"""
api_response = self.corev1.create_namespace(
client.V1Namespace(metadata=client.V1ObjectMeta(
- generate_name="ims-")))
+ generate_name=self.ns_generate_name)))
self.namespace = api_response.metadata.name
self.__logger.debug("create_namespace: %s", api_response)
self.zone = '{}.svc.cluster.local'.format(self.namespace)
diff --git a/functest_kubernetes/security/security.py b/functest_kubernetes/security/security.py
index fe3d8a93..f83827db 100644
--- a/functest_kubernetes/security/security.py
+++ b/functest_kubernetes/security/security.py
@@ -46,6 +46,7 @@ class SecurityTesting(testcase.TestCase):
self.output_log_name = 'functest-kubernetes.log'
self.output_debug_log_name = 'functest-kubernetes.debug.log'
self.namespace = ""
+ self.ns_generate_name = "security-"
def deploy_job(self):
"""Run Security job
@@ -56,7 +57,7 @@ class SecurityTesting(testcase.TestCase):
assert self.job_name
api_response = self.corev1.create_namespace(
client.V1Namespace(metadata=client.V1ObjectMeta(
- generate_name="ims-")))
+ generate_name=self.ns_generate_name)))
self.namespace = api_response.metadata.name
self.__logger.debug("create_namespace: %s", api_response)
# pylint: disable=bad-continuation
@@ -129,6 +130,7 @@ class KubeHunter(SecurityTesting):
def __init__(self, **kwargs):
super(KubeHunter, self).__init__(**kwargs)
self.job_name = "kube-hunter"
+ self.ns_generate_name = "kube-hunter-"
def process_results(self, **kwargs):
"""Process kube-hunter details"""
@@ -192,6 +194,11 @@ class KubeBench(SecurityTesting):
__logger = logging.getLogger(__name__)
+ def __init__(self, **kwargs):
+ super(KubeBench, self).__init__(**kwargs)
+ self.job_name = "kube-bench"
+ self.ns_generate_name = "kube-bench-"
+
def run(self, **kwargs):
self.job_name = "kube-bench-{}".format(kwargs.get("target", "node"))
super(KubeBench, self).run(**kwargs)