Skip to content

Commit

Permalink
Merge pull request #1464 from jduepmeier/tunnel-k8s-rest-client
Browse files Browse the repository at this point in the history
fix(k8s): honor options.RestConfig in tunnel.ForwardPortE
  • Loading branch information
denis256 authored Dec 17, 2024
2 parents 23bc092 + 0b99951 commit bb92e35
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions modules/k8s/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,18 @@ func (tunnel *Tunnel) ForwardPortE(t testing.TestingT) error {
tunnel.logger.Logf(t, "Error creating a new Kubernetes client: %s", err)
return err
}
kubeConfigPath, err := tunnel.kubectlOptions.GetConfigPath(t)
if err != nil {
tunnel.logger.Logf(t, "Error getting kube config path: %s", err)
return err
}
config, err := LoadApiClientConfigE(kubeConfigPath, tunnel.kubectlOptions.ContextName)
if err != nil {
tunnel.logger.Logf(t, "Error loading Kubernetes config: %s", err)
return err
config := tunnel.kubectlOptions.RestConfig
if config == nil {
kubeConfigPath, err := tunnel.kubectlOptions.GetConfigPath(t)
if err != nil {
tunnel.logger.Logf(t, "Error getting kube config path: %s", err)
return err
}
config, err = LoadApiClientConfigE(kubeConfigPath, tunnel.kubectlOptions.ContextName)
if err != nil {
tunnel.logger.Logf(t, "Error loading Kubernetes config: %s", err)
return err
}
}

// Find the pod to port forward to
Expand Down

0 comments on commit bb92e35

Please sign in to comment.