From d1880f90216bca6251339833726264feea92dffb Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Wed, 15 Jan 2025 21:50:31 +0200 Subject: [PATCH] drenv: Support verbose gather 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 --- test/drenv/__main__.py | 1 + test/drenv/kubectl.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/drenv/__main__.py b/test/drenv/__main__.py index 039ae8012..fe36a5d3f 100644 --- a/test/drenv/__main__.py +++ b/test/drenv/__main__.py @@ -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", diff --git a/test/drenv/kubectl.py b/test/drenv/kubectl.py index 50d718ee0..3f9ae5140 100644 --- a/test/drenv/kubectl.py +++ b/test/drenv/kubectl.py @@ -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. """ @@ -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.