diff --git a/nise/generators/ocp/ocp_generator.py b/nise/generators/ocp/ocp_generator.py index d1403c84..2947a96a 100644 --- a/nise/generators/ocp/ocp_generator.py +++ b/nise/generators/ocp/ocp_generator.py @@ -302,8 +302,9 @@ def _gen_namespaces(self, nodes): for node in nodes: if node.get("namespaces"): for name, _ in node.get("namespaces").items(): - namespace = name - namespaces[namespace] = node + for i in range(2500): # TODO PERF_NOTE: update this - number of replicas for each namespace + namespace = f"{name}_perf_{i}" + namespaces[namespace] = node else: num_namespaces = randint(2, 12) for _ in range(num_namespaces): @@ -356,9 +357,10 @@ def _gen_pods(self, namespaces): for namespace, node in namespaces.items(): namespace2pod[namespace] = [] if node.get("namespaces"): - specified_pods = node.get("namespaces").get(namespace).get("pods") or [] + orig_namespace, perf_suffix = namespace.split("_perf_") + specified_pods = node.get("namespaces").get(orig_namespace).get("pods") or [] for specified_pod in specified_pods: - pod = specified_pod.get("pod_name", self.fake.word()) + pod = f"{specified_pod.get('pod_name', self.fake.word())}_{perf_suffix}" namespace2pod[namespace].append(pod) cpu_cores = node.get("cpu_cores") memory_bytes = node.get("memory_bytes") @@ -527,7 +529,8 @@ def _gen_volumes(self, namespaces, namespace2pods): # noqa: R0914,C901 for namespace, node in namespaces.items(): storage_class_default = choice(("gp2", "fast", "slow", "gold")) if node.get("namespaces"): - specified_volumes = node.get("namespaces").get(namespace).get("volumes", []) + orig_namespace = namespace.split("_perf_")[0] + specified_volumes = node.get("namespaces").get(orig_namespace).get("volumes", []) for specified_volume in specified_volumes: volume = specified_volume.get("volume_name", self.fake.word()) volume_request_gig = specified_volume.get("volume_request_gig") diff --git a/nise/report.py b/nise/report.py index 54d3ad57..f15571ec 100644 --- a/nise/report.py +++ b/nise/report.py @@ -97,6 +97,7 @@ def create_temporary_copy(path, temp_file_name, temp_dir_name="None"): """Create temporary copy of a file.""" + # PERF_NOTE - if your /tmp dir doesn't have enough space, you may need to specify different temp_dir temp_dir = gettempdir() if temp_dir_name: new_dir = os.path.join(temp_dir, temp_dir_name)