Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v13] Fix Kubernetes selected cluster #32087

Merged
merged 9 commits into from Sep 19, 2023

Conversation

GavinFrazar
Copy link
Contributor

@GavinFrazar GavinFrazar commented Sep 18, 2023

backports #30167 to branch/v13.

stacked on #32086

(Multiple PRs stacked on this one were merged into this PR before merging it into branch/v13. Here are the change logs):

changelog: tsh [proxy | db | kube] subcommands now support --query and --labels optional arguments.
changelog: tsh and tctl can select an auto-discovered database or Kubernetes cluster by its original name instead of the more detailed name generated by the v14+ Teleport Discovery service.

@github-actions github-actions bot added kubernetes-access size/md tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Sep 18, 2023
Base automatically changed from gavinfrazar/v13-tctl-resource-selection-ux to gavinfrazar/v13-tsh-request-search-display-ux September 18, 2023 23:27
@GavinFrazar GavinFrazar force-pushed the gavinfrazar/v13-tsh-request-search-display-ux branch from 8b1bb7d to 2749bde Compare September 18, 2023 23:29
Base automatically changed from gavinfrazar/v13-tsh-request-search-display-ux to gavinfrazar/tsh-kube-ls-ux September 18, 2023 23:30
Base automatically changed from gavinfrazar/tsh-kube-ls-ux to branch/v13 September 19, 2023 00:01
backports #30167 to branch/v13.

* Fix Kubernetes selected cluster

Kubeconfig context name can be customized using `--set-context-name`
flag. When using it, the selected Kubernetes cluster fails to correctly
identify the cluster name.
@GavinFrazar GavinFrazar force-pushed the gavinfrazar/v13-correct-selected-cluster branch from fba0ce8 to e1b7756 Compare September 19, 2023 00:03
GavinFrazar and others added 8 commits September 18, 2023 17:44
backports #30252 to branch/v13.

* fetch kube clusters once for login
backports #30478 to branch/v13.

* select by labels, query predicate, name, and/or prefix of name.
* fix --cluster flag not being propagated
backports #31689 to branch/v13.

* disallow prefix matching
* select by exact name match first,
* otherwise look for unambiguous discovered name label match.
* look for an active db to resolve discovered name match ambiguity.
* add more predicate builder helpers
* check for db name in not found error for stale cert hint
* no error status on tsh db logout with no logged in dbs
* remove dead code
* refactor helper funcs to simplify code and make it easier to test
* test complex database selection
* test findActiveDatabase
* test choosing one db by discovered name
* add more resource selectors tests
* test formatDatabaseLoginCommand
* add debug logging for db selection
…32095)

Backports #31418 to branch/v13.

This PR uses `client.RetryWithRelogin` helper to deal with cases where user's
credentials don't exist or are already expired.

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
* fix retry with relogin for ambiguous clusters
* consolidate test setup for login/proxy kube selection tests
* add more test cases for kube selection
* remove prefix testing
* add origin cloud label in tests
* refactor the check for multiple cluster login into a func
Backports #31916 to branch/v13.

* remove prefix matching in tctl
* replace prefix matching with exact discovered name match as a fallback
  when no resource full name matches the name given by a user
* refactor test helpers
* avoid decoding yaml/json into already initialized var
@GavinFrazar GavinFrazar added this pull request to the merge queue Sep 19, 2023
Merged via the queue into branch/v13 with commit 04d8985 Sep 19, 2023
18 of 19 checks passed
@GavinFrazar GavinFrazar deleted the gavinfrazar/v13-correct-selected-cluster branch September 19, 2023 01:32
@camscale camscale mentioned this pull request Sep 20, 2023
@fheinecke fheinecke mentioned this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kubernetes-access size/md tsh tsh - Teleport's command line tool for logging into nodes running Teleport.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants