Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tftestenv/testenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/hashicorp/terraform-exec/tfexec"
tfjson "github.com/hashicorp/terraform-json"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/klog/v2/klogr"
Expand All @@ -46,7 +47,8 @@ var shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM}
// Environment encapsulates a Kubernetes test environment.
type Environment struct {
client.Client
Config *rest.Config
ClientGo *kubernetes.Clientset
Config *rest.Config

// CreateKubeconfig provides the terraform state output which is used to
// construct kubeconfig.
Expand Down Expand Up @@ -265,6 +267,10 @@ func (env *Environment) createAndConfigure(ctx context.Context, scheme *runtime.
if err != nil {
return fmt.Errorf("failed to create new client: %w", err)
}
env.ClientGo, err = kubernetes.NewForConfig(kubeCfg)
if err != nil {
return fmt.Errorf("failed to create client-go client: %w", err)
}

return nil
}
Expand Down