From af13078d10520618d05e5de9551a1252302ee7ec Mon Sep 17 00:00:00 2001 From: Liyu Ma Date: Mon, 30 Nov 2026 05:27:57 +0000 Subject: [PATCH 1/4] Pull the AWS OS disk Fio image from ECR Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- modules/python/fio/fio.py | 6 +++++- modules/python/tests/test_fio.py | 3 +++ pipelines/perf-eval/Storage Benchmark/k8s-os-disk-fio.yml | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/python/fio/fio.py b/modules/python/fio/fio.py index e6c1bf3612..c5d4a809d4 100644 --- a/modules/python/fio/fio.py +++ b/modules/python/fio/fio.py @@ -80,6 +80,10 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na "--group_reporting" ] + container = {"name": "fio", "command": fio_command} + if image := os.getenv("FIO_IMAGE"): + container["image"] = image + os.makedirs(result_dir, exist_ok=True) job_node_mapping = [] # Store job names and their corresponding nodes @@ -97,7 +101,7 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na "spec": { "template": { "spec": { - "containers": [{"name": "fio", "command": fio_command}], + "containers": [container], "nodeSelector": { "kubernetes.io/hostname": node_name }, diff --git a/modules/python/tests/test_fio.py b/modules/python/tests/test_fio.py index 508ed8acae..0f36ae479f 100644 --- a/modules/python/tests/test_fio.py +++ b/modules/python/tests/test_fio.py @@ -23,6 +23,7 @@ def test_validate(self, mock_wait_for_nodes_ready): @patch("fio.fio.os.makedirs") @patch("subprocess.run") @patch("builtins.open", new_callable=mock_open) + @patch.dict("os.environ", FIO_IMAGE="example.registry/fio:3.40") def test_execute_success( self, mock_open_file, mock_run, mock_makedirs, mock_yaml_dump, mock_k8s_client ): @@ -68,6 +69,8 @@ def test_execute_success( # Verify the yaml patch was written (once per node) mock_yaml_dump.assert_called_once() + job_patch = mock_yaml_dump.call_args.args[0] + self.assertEqual(job_patch["spec"]["template"]["spec"]["containers"][0]["image"], "example.registry/fio:3.40") # Verify subprocess.run was called twice (create and delete commands) self.assertEqual(mock_run.call_count, 2) diff --git a/pipelines/perf-eval/Storage Benchmark/k8s-os-disk-fio.yml b/pipelines/perf-eval/Storage Benchmark/k8s-os-disk-fio.yml index 3452da562c..ea218b93be 100644 --- a/pipelines/perf-eval/Storage Benchmark/k8s-os-disk-fio.yml +++ b/pipelines/perf-eval/Storage Benchmark/k8s-os-disk-fio.yml @@ -122,6 +122,7 @@ stages: m7i.4xlarge: k8s_machine_type: m7i.4xlarge storage_name: os-disk + fio_image: 891516228446.dkr.ecr.us-west-2.amazonaws.com/telescope-benchmarks:fio-3.40 desired_nodes: 3 max_parallel: 1 timeout_in_minutes: 120 From d2dce4c88c4eae3ff2d7fcd639fde674cf3da656 Mon Sep 17 00:00:00 2001 From: Liyu Ma Date: Mon, 30 Nov 2026 06:25:36 +0000 Subject: [PATCH 2/4] Require explicit Fio images and render jobs with kubectl kustomize Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- modules/python/fio/fio.py | 31 ++++++++------ modules/python/tests/test_fio.py | 40 +++++++++++-------- .../Storage Benchmark/k8s-nvme-disk-fio.yml | 1 + .../Storage Benchmark/k8s-os-disk-fio.yml | 4 +- steps/engine/fio/execute.yml | 12 +++++- steps/topology/k8s-os-disk/execute-fio.yml | 1 + 6 files changed, 58 insertions(+), 31 deletions(-) diff --git a/modules/python/fio/fio.py b/modules/python/fio/fio.py index c5d4a809d4..ac9ffc15ae 100644 --- a/modules/python/fio/fio.py +++ b/modules/python/fio/fio.py @@ -55,7 +55,19 @@ def calculate_pod_startup_latency(pod): logger.error(f"Error calculating pod startup latency for pod {pod.metadata.name}: {str(e)}") return None -def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_name, kustomize_dir, result_dir): +def _run_job_manifest(action, overlay, job_name): + logger.info("Rendering %s for kubectl %s (job %s)", overlay, action, job_name) + rendered = subprocess.run(["kubectl", "kustomize", overlay], stdout=subprocess.PIPE, check=True) + manifest = subprocess.run( + ["envsubst"], input=rendered.stdout, stdout=subprocess.PIPE, + env={**os.environ, "name": job_name}, check=True, + ) + subprocess.run(["kubectl", action, "-f", "-"], input=manifest.stdout, check=True) + + +def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_name, kustomize_dir, result_dir, image): + if not image.strip(): + raise ValueError("A non-empty Fio container image is required") fio_nodes = KUBERNETES_CLIENT.get_ready_nodes(label_selector='fio-dedicated=true') if not fio_nodes: raise RuntimeError("No ready and schedulable nodes found with label 'fio-dedicated=true'.") @@ -80,11 +92,8 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na "--group_reporting" ] - container = {"name": "fio", "command": fio_command} - if image := os.getenv("FIO_IMAGE"): - container["image"] = image - os.makedirs(result_dir, exist_ok=True) + overlay = os.path.join(kustomize_dir, "overlays", storage_name, "deployment") job_node_mapping = [] # Store job names and their corresponding nodes for i, node in enumerate(fio_nodes): @@ -101,7 +110,7 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na "spec": { "template": { "spec": { - "containers": [container], + "containers": [{"name": "fio", "command": fio_command, "image": image}], "nodeSelector": { "kubernetes.io/hostname": node_name }, @@ -115,9 +124,7 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na with open(patch_file, "w", encoding="utf-8") as f: yaml.dump(patch, f) - create_command = f"kustomize build {kustomize_dir}/overlays/{storage_name}/deployment | name={job_name} envsubst | kubectl apply -f -" - logger.info(f"Running command: {create_command}") - subprocess.run(create_command, shell=True, check=True, capture_output=True) + _run_job_manifest("apply", overlay, job_name) metadata_path = f"{result_dir}/fio-{block_size}-{iodepth}-{method}-{numjobs}-{file_size}-metadata.json" result_path = f"{result_dir}/fio-{block_size}-{iodepth}-{method}-{numjobs}-{file_size}.json" @@ -176,9 +183,7 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na f.write(json.dumps(metadata) + "\n") logger.info(f"Metadata saved to {metadata_path}") - delete_command = f"kustomize build {kustomize_dir}/overlays/{storage_name}/deployment | name={job_name} envsubst | kubectl delete -f -" - logger.info(f"Running command: {delete_command}") - subprocess.run(delete_command, shell=True, check=True, capture_output=True) + _run_job_manifest("delete", overlay, job_name) def collect(vm_size, block_size, iodepth, method, numjobs, file_size, result_dir, run_url, cloud_info): raw_result_path = f"{result_dir}/fio-{block_size}-{iodepth}-{method}-{numjobs}-{file_size}.json" @@ -258,6 +263,7 @@ def main(): parser_execute.add_argument("--numjobs", type=int, help="Number of jobs") parser_execute.add_argument("--file_size", type=str, help="File size") parser_execute.add_argument("--storage_name", type=str, help="Storage name") + parser_execute.add_argument("--image", required=True, help="Fio container image") parser_execute.add_argument("--kustomize_dir", type=str, help="Directory for kustomize") parser_execute.add_argument( "--result_dir", type=str, help="Directory to store results" @@ -293,6 +299,7 @@ def main(): args.storage_name, args.kustomize_dir, args.result_dir, + args.image, ) elif args.command == "collect": collect( diff --git a/modules/python/tests/test_fio.py b/modules/python/tests/test_fio.py index 0f36ae479f..1076759d96 100644 --- a/modules/python/tests/test_fio.py +++ b/modules/python/tests/test_fio.py @@ -1,10 +1,11 @@ import unittest import json +import subprocess from datetime import datetime, timezone from unittest.mock import patch, MagicMock, mock_open # Mock kubernetes config before importing with patch('kubernetes.config.load_kube_config'): - from fio.fio import validate, execute, collect, main + from fio.fio import validate, execute, collect, main, _run_job_manifest class TestFio(unittest.TestCase): def setUp(self): @@ -23,7 +24,6 @@ def test_validate(self, mock_wait_for_nodes_ready): @patch("fio.fio.os.makedirs") @patch("subprocess.run") @patch("builtins.open", new_callable=mock_open) - @patch.dict("os.environ", FIO_IMAGE="example.registry/fio:3.40") def test_execute_success( self, mock_open_file, mock_run, mock_makedirs, mock_yaml_dump, mock_k8s_client ): @@ -65,6 +65,7 @@ def test_execute_success( storage_name, kustomize_dir, result_dir, + image="example.registry/fio:3.40", ) # Verify the yaml patch was written (once per node) @@ -72,18 +73,11 @@ def test_execute_success( job_patch = mock_yaml_dump.call_args.args[0] self.assertEqual(job_patch["spec"]["template"]["spec"]["containers"][0]["image"], "example.registry/fio:3.40") - # Verify subprocess.run was called twice (create and delete commands) - self.assertEqual(mock_run.call_count, 2) - - # Verify the create command - create_call = mock_run.call_args_list[0] - self.assertTrue("kustomize build" in create_call[0][0]) - self.assertTrue("kubectl apply" in create_call[0][0]) - - # Verify the delete command - delete_call = mock_run.call_args_list[1] - self.assertTrue("kustomize build" in delete_call[0][0]) - self.assertTrue("kubectl delete" in delete_call[0][0]) + render = ["kubectl", "kustomize", "/tmp/kustomize/overlays/fio/deployment"] + self.assertEqual([call.args[0] for call in mock_run.call_args_list], [ + render, ["envsubst"], ["kubectl", "apply", "-f", "-"], + render, ["envsubst"], ["kubectl", "delete", "-f", "-"], + ]) # Verify the result directory was created mock_makedirs.assert_called_once_with(result_dir, exist_ok=True) @@ -135,10 +129,22 @@ def test_execute_failure_with_no_nodes(self, mock_k8s_client): storage_name, kustomize_dir, result_dir, + image="example.registry/fio:3.40", ) self.assertEqual(str(context.exception), "No ready and schedulable nodes found with label 'fio-dedicated=true'.") + def test_execute_rejects_empty_image(self): + with self.assertRaisesRegex(ValueError, "non-empty Fio container image"): + execute("4k", 16, "read", 60, 1, "10G", "fio", "/tmp/kustomize", "/tmp/results", " ") + + @patch("subprocess.run") + def test_render_failure_stops_before_apply(self, mock_run): + mock_run.side_effect = subprocess.CalledProcessError(1, ["kubectl", "kustomize", "overlay"]) + with self.assertRaises(subprocess.CalledProcessError): + _run_job_manifest("apply", "overlay", "fio-0") + mock_run.assert_called_once_with(["kubectl", "kustomize", "overlay"], stdout=subprocess.PIPE, check=True) + @patch("fio.fio.KUBERNETES_CLIENT") @patch("fio.fio.yaml.dump") @patch("fio.fio.os.makedirs") @@ -180,11 +186,12 @@ def test_execute_with_no_pods_found( storage_name, kustomize_dir, result_dir, + image="example.registry/fio:3.40", ) # The function should still create the job and patch file mock_yaml_dump.assert_called_once() - self.assertEqual(mock_run.call_count, 1) # only create command, delete is skipped due to no pods + self.assertEqual(mock_run.call_args.args[0], ["kubectl", "apply", "-f", "-"]) @patch('builtins.open', new_callable=mock_open) @patch('fio.fio.datetime') @@ -330,13 +337,14 @@ def test_main_execute_command(self, mock_execute, mock_parse_args): mock_args.file_size = "10G" mock_args.storage_name = "fio" mock_args.kustomize_dir = "/tmp/kustomize" + mock_args.image = "example.registry/fio:3.40" mock_args.result_dir = "/tmp/results" mock_parse_args.return_value = mock_args main() mock_execute.assert_called_once_with( - "4k", 16, "read", 60, 1, "10G", "fio", "/tmp/kustomize", "/tmp/results" + "4k", 16, "read", 60, 1, "10G", "fio", "/tmp/kustomize", "/tmp/results", "example.registry/fio:3.40" ) @patch("argparse.ArgumentParser.parse_args") diff --git a/pipelines/perf-eval/Storage Benchmark/k8s-nvme-disk-fio.yml b/pipelines/perf-eval/Storage Benchmark/k8s-nvme-disk-fio.yml index 1110ab2f89..fe3fecd922 100644 --- a/pipelines/perf-eval/Storage Benchmark/k8s-nvme-disk-fio.yml +++ b/pipelines/perf-eval/Storage Benchmark/k8s-nvme-disk-fio.yml @@ -27,6 +27,7 @@ stages: topology: k8s-os-disk engine: fio engine_input: + fio_image: telescope.azurecr.io/perf-eval/fio:3.40 fio_command_array: - "128k|16|write|600|16|32G" - "128k|16|read|600|16|32G" diff --git a/pipelines/perf-eval/Storage Benchmark/k8s-os-disk-fio.yml b/pipelines/perf-eval/Storage Benchmark/k8s-os-disk-fio.yml index ea218b93be..7ca470e145 100644 --- a/pipelines/perf-eval/Storage Benchmark/k8s-os-disk-fio.yml +++ b/pipelines/perf-eval/Storage Benchmark/k8s-os-disk-fio.yml @@ -37,6 +37,7 @@ stages: topology: k8s-os-disk engine: fio engine_input: + fio_image: telescope.azurecr.io/perf-eval/fio:3.40 fio_command_array: - "4k|32|randread|180|1|10G" - "4k|32|randwrite|180|1|10G" @@ -76,6 +77,7 @@ stages: topology: k8s-os-disk engine: fio engine_input: + fio_image: telescope.azurecr.io/perf-eval/fio:3.40 fio_command_array: - "4k|32|randread|180|1|10G" - "4k|32|randwrite|180|1|10G" @@ -113,6 +115,7 @@ stages: topology: k8s-os-disk engine: fio engine_input: + fio_image: 891516228446.dkr.ecr.us-west-2.amazonaws.com/telescope-benchmarks:fio-3.40 fio_command_array: - "4k|32|randread|180|1|10G" - "4k|32|randwrite|180|1|10G" @@ -122,7 +125,6 @@ stages: m7i.4xlarge: k8s_machine_type: m7i.4xlarge storage_name: os-disk - fio_image: 891516228446.dkr.ecr.us-west-2.amazonaws.com/telescope-benchmarks:fio-3.40 desired_nodes: 3 max_parallel: 1 timeout_in_minutes: 120 diff --git a/steps/engine/fio/execute.yml b/steps/engine/fio/execute.yml index 10baa7adef..139ee4ccc9 100644 --- a/steps/engine/fio/execute.yml +++ b/steps/engine/fio/execute.yml @@ -1,6 +1,12 @@ parameters: - fio_properties: {} # format: block_size|iodepth|method|runtime|numjobs|file_size - storage_name: '' + - name: fio_properties # format: block_size|iodepth|method|runtime|numjobs|file_size + type: object + default: {} + - name: storage_name + type: string + default: '' + - name: fio_image + type: string steps: - ${{ each property in parameters.fio_properties }}: @@ -23,6 +29,7 @@ steps: --numjobs $numjobs \ --file_size $file_size \ --storage_name $STORAGE_NAME \ + --image "$FIO_IMAGE" \ --kustomize_dir $KUSTOMIZE_DIR \ --result_dir $RESULT_DIR @@ -33,4 +40,5 @@ steps: KUSTOMIZE_DIR: $(Pipeline.Workspace)/s/modules/kustomize/fio RESULT_DIR: $(TEST_RESULTS_DIR) FIO_PROPERTY: ${{ property }} + FIO_IMAGE: ${{ parameters.fio_image }} STORAGE_NAME: ${{ parameters.storage_name }} diff --git a/steps/topology/k8s-os-disk/execute-fio.yml b/steps/topology/k8s-os-disk/execute-fio.yml index 5a2a77b884..cdf2b648d1 100644 --- a/steps/topology/k8s-os-disk/execute-fio.yml +++ b/steps/topology/k8s-os-disk/execute-fio.yml @@ -13,4 +13,5 @@ steps: - template: /steps/engine/fio/execute.yml parameters: fio_properties: ${{ parameters.engine_input.fio_command_array }} + fio_image: ${{ parameters.engine_input.fio_image }} storage_name: $(STORAGE_NAME) From 512f05add461e004a5a864d12cd720dfc9014c3f Mon Sep 17 00:00:00 2001 From: Liyu Ma Date: Mon, 30 Nov 2026 06:57:19 +0000 Subject: [PATCH 3/4] Simplify Fio job rendering with inline kubectl pipelines Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- modules/python/fio/fio.py | 21 ++++++++------------- modules/python/tests/test_fio.py | 19 +++++-------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/modules/python/fio/fio.py b/modules/python/fio/fio.py index ac9ffc15ae..24cfd0379b 100644 --- a/modules/python/fio/fio.py +++ b/modules/python/fio/fio.py @@ -1,6 +1,7 @@ import argparse import json import os +import shlex import subprocess from datetime import datetime, timezone import yaml @@ -55,16 +56,6 @@ def calculate_pod_startup_latency(pod): logger.error(f"Error calculating pod startup latency for pod {pod.metadata.name}: {str(e)}") return None -def _run_job_manifest(action, overlay, job_name): - logger.info("Rendering %s for kubectl %s (job %s)", overlay, action, job_name) - rendered = subprocess.run(["kubectl", "kustomize", overlay], stdout=subprocess.PIPE, check=True) - manifest = subprocess.run( - ["envsubst"], input=rendered.stdout, stdout=subprocess.PIPE, - env={**os.environ, "name": job_name}, check=True, - ) - subprocess.run(["kubectl", action, "-f", "-"], input=manifest.stdout, check=True) - - def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_name, kustomize_dir, result_dir, image): if not image.strip(): raise ValueError("A non-empty Fio container image is required") @@ -93,7 +84,7 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na ] os.makedirs(result_dir, exist_ok=True) - overlay = os.path.join(kustomize_dir, "overlays", storage_name, "deployment") + overlay = shlex.quote(os.path.join(kustomize_dir, "overlays", storage_name, "deployment")) job_node_mapping = [] # Store job names and their corresponding nodes for i, node in enumerate(fio_nodes): @@ -124,7 +115,9 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na with open(patch_file, "w", encoding="utf-8") as f: yaml.dump(patch, f) - _run_job_manifest("apply", overlay, job_name) + create_command = f"kubectl kustomize {overlay} | name={job_name} envsubst | kubectl apply -f -" + logger.info("Running command: %s", create_command) + subprocess.run(["bash", "-o", "pipefail", "-c", create_command], check=True) metadata_path = f"{result_dir}/fio-{block_size}-{iodepth}-{method}-{numjobs}-{file_size}-metadata.json" result_path = f"{result_dir}/fio-{block_size}-{iodepth}-{method}-{numjobs}-{file_size}.json" @@ -183,7 +176,9 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na f.write(json.dumps(metadata) + "\n") logger.info(f"Metadata saved to {metadata_path}") - _run_job_manifest("delete", overlay, job_name) + delete_command = f"kubectl kustomize {overlay} | name={job_name} envsubst | kubectl delete -f -" + logger.info("Running command: %s", delete_command) + subprocess.run(["bash", "-o", "pipefail", "-c", delete_command], check=True) def collect(vm_size, block_size, iodepth, method, numjobs, file_size, result_dir, run_url, cloud_info): raw_result_path = f"{result_dir}/fio-{block_size}-{iodepth}-{method}-{numjobs}-{file_size}.json" diff --git a/modules/python/tests/test_fio.py b/modules/python/tests/test_fio.py index 1076759d96..e2bf9afbae 100644 --- a/modules/python/tests/test_fio.py +++ b/modules/python/tests/test_fio.py @@ -1,11 +1,10 @@ import unittest import json -import subprocess from datetime import datetime, timezone from unittest.mock import patch, MagicMock, mock_open # Mock kubernetes config before importing with patch('kubernetes.config.load_kube_config'): - from fio.fio import validate, execute, collect, main, _run_job_manifest + from fio.fio import validate, execute, collect, main class TestFio(unittest.TestCase): def setUp(self): @@ -73,10 +72,9 @@ def test_execute_success( job_patch = mock_yaml_dump.call_args.args[0] self.assertEqual(job_patch["spec"]["template"]["spec"]["containers"][0]["image"], "example.registry/fio:3.40") - render = ["kubectl", "kustomize", "/tmp/kustomize/overlays/fio/deployment"] - self.assertEqual([call.args[0] for call in mock_run.call_args_list], [ - render, ["envsubst"], ["kubectl", "apply", "-f", "-"], - render, ["envsubst"], ["kubectl", "delete", "-f", "-"], + render = "kubectl kustomize /tmp/kustomize/overlays/fio/deployment | name=fio-0 envsubst" + self.assertEqual([call.args[0][-1] for call in mock_run.call_args_list], [ + f"{render} | kubectl apply -f -", f"{render} | kubectl delete -f -", ]) # Verify the result directory was created @@ -138,13 +136,6 @@ def test_execute_rejects_empty_image(self): with self.assertRaisesRegex(ValueError, "non-empty Fio container image"): execute("4k", 16, "read", 60, 1, "10G", "fio", "/tmp/kustomize", "/tmp/results", " ") - @patch("subprocess.run") - def test_render_failure_stops_before_apply(self, mock_run): - mock_run.side_effect = subprocess.CalledProcessError(1, ["kubectl", "kustomize", "overlay"]) - with self.assertRaises(subprocess.CalledProcessError): - _run_job_manifest("apply", "overlay", "fio-0") - mock_run.assert_called_once_with(["kubectl", "kustomize", "overlay"], stdout=subprocess.PIPE, check=True) - @patch("fio.fio.KUBERNETES_CLIENT") @patch("fio.fio.yaml.dump") @patch("fio.fio.os.makedirs") @@ -191,7 +182,7 @@ def test_execute_with_no_pods_found( # The function should still create the job and patch file mock_yaml_dump.assert_called_once() - self.assertEqual(mock_run.call_args.args[0], ["kubectl", "apply", "-f", "-"]) + self.assertEqual(mock_run.call_count, 1) @patch('builtins.open', new_callable=mock_open) @patch('fio.fio.datetime') From 38ae68448c33beb1a45188c05e8ab92d2826759a Mon Sep 17 00:00:00 2001 From: Liyu Ma Date: Mon, 30 Nov 2026 12:23:30 +0000 Subject: [PATCH 4/4] Move Fio overlay path next to the job creation command Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- modules/python/fio/fio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/python/fio/fio.py b/modules/python/fio/fio.py index 24cfd0379b..2b0db4f9b9 100644 --- a/modules/python/fio/fio.py +++ b/modules/python/fio/fio.py @@ -84,7 +84,6 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na ] os.makedirs(result_dir, exist_ok=True) - overlay = shlex.quote(os.path.join(kustomize_dir, "overlays", storage_name, "deployment")) job_node_mapping = [] # Store job names and their corresponding nodes for i, node in enumerate(fio_nodes): @@ -115,6 +114,7 @@ def execute(block_size, iodepth, method, runtime, numjobs, file_size, storage_na with open(patch_file, "w", encoding="utf-8") as f: yaml.dump(patch, f) + overlay = shlex.quote(os.path.join(kustomize_dir, "overlays", storage_name, "deployment")) create_command = f"kubectl kustomize {overlay} | name={job_name} envsubst | kubectl apply -f -" logger.info("Running command: %s", create_command) subprocess.run(["bash", "-o", "pipefail", "-c", create_command], check=True)