Skip to content

Commit

Permalink
Fix multiple profile handling for kube credentials (#23705) (#23718)
Browse files Browse the repository at this point in the history
This PR fixes the multi profile handling for Kubernetes Access flow.
Previously, `tsh kube credentials` assumed the default profile because
no proxy was provided when kubectl invokes the credentials plugin which
resulted in usage of wrong certificates.

This PR prevents that by appending the `--proxy` flag to kubectl exec
plugin which allows `tsh kube credentials` to correctly identify the
correct profile.
  • Loading branch information
tigrato committed Mar 29, 2023
1 parent 95e243d commit 92f50d2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tool/tsh/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,10 @@ func updateKubeConfig(cf *CLIConf, tc *client.TeleportClient, path string) error
return trace.Wrap(err)
}

if cf.Proxy == "" {
cf.Proxy = tc.WebProxyAddr
}

values, err := buildKubeConfigUpdate(cf, kubeStatus)
if err != nil {
return trace.Wrap(err)
Expand Down

0 comments on commit 92f50d2

Please sign in to comment.