Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions nise/generators/ocp/ocp_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions nise/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down