Skip to content

Commit

Permalink
adds custom logger to kubectl options
Browse files Browse the repository at this point in the history
This commit adds the custom logging facility to kubectl options and to
the Kubectl Run with output that can be used to suppress stdout from
Kubectl run if needed.

The logging facility was introduced on #510 but it missed kubectl
options.

Fixes #358 since @blame19 recalled that the behavior was missing on the
k8s module.

Signed-off-by: Anne Macedo <[email protected]>
  • Loading branch information
retpolanne committed Jul 24, 2023
1 parent adad5f9 commit f52242e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/k8s/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func RunKubectlAndGetOutputE(t testing.TestingT, options *KubectlOptions, args .
Command: "kubectl",
Args: cmdArgs,
Env: options.Env,
Logger: options.Logger,
}
return shell.RunCommandAndGetOutputE(t, command)
}
Expand Down
2 changes: 2 additions & 0 deletions modules/k8s/kubectl_options.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package k8s

import (
"github.com/gruntwork-io/terratest/modules/logger"
"github.com/gruntwork-io/terratest/modules/testing"
)

Expand All @@ -11,6 +12,7 @@ type KubectlOptions struct {
Namespace string
Env map[string]string
InClusterAuth bool
Logger *logger.Logger
}

// NewKubectlOptions will return a pointer to new instance of KubectlOptions with the configured options
Expand Down

0 comments on commit f52242e

Please sign in to comment.