handle discovery renaming when listing resource in tctl text format#29887
handle discovery renaming when listing resource in tctl text format#29887GavinFrazar merged 9 commits intomasterfrom
tctl text format#29887Conversation
* display the discovered name from label in non-verbose text format for db, db_server, kube_cluster, kube_server resources.
|
|
||
| // SortRowsBy sorts the table rows with the given column indices as the sorting | ||
| // key, optionally performing a stable sort. | ||
| func (t *Table) SortRowsBy(colIdxKey []int, stable bool) { |
There was a problem hiding this comment.
can we validate the the ColIdx is not greater than len(t.columns) ?
|
Is there an easy way to test those discoverable resources with a local cluster? I suspect there's no easy way and it'd be best to set up a cluster in our Cloud + some dbs on AWS. I only verified that regular resources still have correct names when using those tctl commands. |
yeah this is the best way. we have databases already in several regions in our dev account, you just need to configure a discovery service in your local cluster. You can make an IAM role with the required permissions in our dev account and have the discovery service assume that role with |
|
@GavinFrazar See the table below for backport results.
|
…format backports #29887 to branch/v13. * display discovered resource name in tctl output * display the discovered name from label in non-verbose text format for db, db_server, kube_cluster, kube_server resources. * support labels, predicate, search in tctl kube ls * avoid type conversion in tctl db ls * sort kube and db objects in tctl text tables * test kube/database collection text format output * check column indices are in range
…format backports #29887 to branch/v13. * display discovered resource name in tctl output * display the discovered name from label in non-verbose text format for db, db_server, kube_cluster, kube_server resources. * support labels, predicate, search in tctl kube ls * avoid type conversion in tctl db ls * sort kube and db objects in tctl text tables * test kube/database collection text format output * check column indices are in range
#32083) * [v13] Deflake `TestListKube` backports #30024 to branch/v13. * Deflake `TestListKube` * Plumbing through custom kube config path PR #29993 tried to deflake this test but only fixed it partially during login. This prevents the kubeconfig in `$HOME/.kube/config` to be used everywhere * [v13] handle discovery renaming when listing resource in `tctl` text format backports #29887 to branch/v13. * display discovered resource name in tctl output * display the discovered name from label in non-verbose text format for db, db_server, kube_cluster, kube_server resources. * support labels, predicate, search in tctl kube ls * avoid type conversion in tctl db ls * sort kube and db objects in tctl text tables * test kube/database collection text format output * check column indices are in range --------- Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
This PR updates
tctlto list resources in a text table by their "discovered name" in non-verbose mode.changelog:
tctltext-formatted output in non-verbose mode will display auto-discovered resources with original resource names instead of the more detailed names generated by the v14+ Teleport Discovery service.Since discovery renaming only applies to databases and kube clusters currently, I only updated the output for those kinds of resources.
Updated commands:
tctl get [db | db_server | kube_cluster | kube_server] --format=texttctl db lstctl kube lsWhy
RFD 129 resolves discovery resource name collisions by renaming discovered resources with a suffix that includes additional distinguishing information. However, we decided users will most of the time not want to see long resource names that include that suffix.
Related issue:
Therefore, this PR will display the original resource name in non-verbose mode, and the full name in verbose mode.
Examples: