Skip to content

Commit 590d2ff

Browse files
authored
add since and timeout switch to must-gather (#356)
* add since and timeout switch to must-gather * add examples
1 parent ac3f8eb commit 590d2ff

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ocp_utilities/must_gather.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def run_must_gather(
1717
skip_tls_check: bool = False,
1818
script_name: str = "",
1919
flag_names: str = "",
20+
since: str = "",
21+
timeout: str = "",
2022
) -> str:
2123
"""
2224
Run must gather command with an option to create target directory.
@@ -33,7 +35,10 @@ def run_must_gather(
3335
3436
Note: flag is optional parameter for must-gather. When it is not passed "--default" flag is used by
3537
must-gather. However, flag_names can not be passed without script_name
36-
38+
since (str, optional): since when the data should be collected. format is: '(+|-)[0-9]+(s|m|h|d)'
39+
Example: 100s or 10m
40+
timeout (str, optional): runs the debug pods for specified duration, timeout string needs to include the unit of time
41+
Example: 600s
3742
Returns:
3843
str: command output
3944
"""
@@ -48,6 +53,10 @@ def run_must_gather(
4853
base_command += f" --kubeconfig {kubeconfig}"
4954
if script_name:
5055
base_command += f" -- {script_name}"
56+
if since:
57+
base_command += f" --since={since}"
58+
if timeout:
59+
base_command += f" --timeout={timeout}"
5160
# flag_name must be the last argument
5261
if flag_names:
5362
flag_string = "".join([f" --{flag_name}" for flag_name in flag_names])

0 commit comments

Comments
 (0)