Skip to content

Commit

Permalink
drenv: Support verbose gather
Browse files Browse the repository at this point in the history
If drenv is run in verbose mode, pass --verbose flag to kubectl-gather
to log more verbose gather logs. This may be useful to debug issues in
kubectl gather in the CI environment.

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs committed Jan 15, 2025
1 parent 53f161b commit d1880f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/drenv/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ def do_gather(args):
directory=args.directory,
namespaces=args.namespaces,
name=env["name"],
verbose=args.verbose,
)
logging.info(
"[%s] Environment gathered in %.2f seconds",
Expand Down
4 changes: 3 additions & 1 deletion test/drenv/kubectl.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def watch(
return commands.watch(*cmd, timeout=timeout)


def gather(contexts, namespaces=None, directory=None, name="gather"):
def gather(contexts, namespaces=None, directory=None, name="gather", verbose=False):
"""
Run kubectl gather plugin, logging gather logs.
"""
Expand All @@ -209,6 +209,8 @@ def gather(contexts, namespaces=None, directory=None, name="gather"):
cmd.extend(("--namespaces", ",".join(namespaces)))
if directory:
cmd.extend(("--directory", directory))
if verbose:
cmd.append("--verbose")

# Redirecting stderr to stdout to get the logs. kubectl gather does not
# output anytihng to stdout.
Expand Down

0 comments on commit d1880f9

Please sign in to comment.