88 // See: https://github.com/kubernetes/client-go/issues/242
99 _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
1010
11- "github.com/gruntwork-io/terratest/modules/logger"
1211 "github.com/gruntwork-io/terratest/modules/testing"
1312)
1413
@@ -33,25 +32,25 @@ func GetKubernetesClientFromOptionsE(t testing.TestingT, options *KubectlOptions
3332 if err != nil {
3433 return nil , err
3534 }
36- logger . Log (t , "Configuring Kubernetes client to use the in-cluster serviceaccount token" )
35+ options . ConfigLogger . Logf (t , "Configuring Kubernetes client to use the in-cluster serviceaccount token" )
3736 } else if options .RestConfig != nil {
3837 config = options .RestConfig
39- logger . Log (t , "Configuring Kubernetes client to use provided rest config object set with API server address: %s" , config .Host )
38+ options . ConfigLogger . Logf (t , "Configuring Kubernetes client to use provided rest config object set with API server address: %s" , config .Host )
4039 } else {
4140 kubeConfigPath , err := options .GetConfigPath (t )
4241 if err != nil {
4342 return nil , err
4443 }
45- logger .Logf (t , "Configuring Kubernetes client using config file %s with context %s" , kubeConfigPath , options .ContextName )
44+ options . ConfigLogger .Logf (t , "Configuring Kubernetes client using config file %s with context %s" , kubeConfigPath , options .ContextName )
4645 // Load API config (instead of more low level ClientConfig)
4746 config , err = LoadApiClientConfigE (kubeConfigPath , options .ContextName )
4847 if err != nil {
49- logger .Logf (t , "Error loading api client config, falling back to in-cluster authentication via serviceaccount token: %s" , err )
48+ options . ConfigLogger .Logf (t , "Error loading api client config, falling back to in-cluster authentication via serviceaccount token: %s" , err )
5049 config , err = rest .InClusterConfig ()
5150 if err != nil {
5251 return nil , err
5352 }
54- logger . Log (t , "Configuring Kubernetes client to use the in-cluster serviceaccount token" )
53+ options . ConfigLogger . Logf (t , "Configuring Kubernetes client to use the in-cluster serviceaccount token" )
5554 }
5655 }
5756
0 commit comments