Skip to content

Commit f52242e

Browse files
committed
adds custom logger to kubectl options
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 <retpolanne@posteo.net>
1 parent adad5f9 commit f52242e

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

modules/k8s/kubectl.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func RunKubectlAndGetOutputE(t testing.TestingT, options *KubectlOptions, args .
4040
Command: "kubectl",
4141
Args: cmdArgs,
4242
Env: options.Env,
43+
Logger: options.Logger,
4344
}
4445
return shell.RunCommandAndGetOutputE(t, command)
4546
}

modules/k8s/kubectl_options.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package k8s
22

33
import (
4+
"github.com/gruntwork-io/terratest/modules/logger"
45
"github.com/gruntwork-io/terratest/modules/testing"
56
)
67

@@ -11,6 +12,7 @@ type KubectlOptions struct {
1112
Namespace string
1213
Env map[string]string
1314
InClusterAuth bool
15+
Logger *logger.Logger
1416
}
1517

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

0 commit comments

Comments
 (0)