mirror of https://github.com/linkerd/linkerd2.git
Fix completion of context (#7389)
Fix completion of context to use context name rather than cluster name Fixes #7362 Signed-off-by: Takumi Sue <u630868b@alumni.osaka-u.ac.jp>
This commit is contained in:
parent
4170b49b33
commit
45349dd4db
|
|
@ -113,13 +113,12 @@ func ConfigureKubeContextFlagCompletion(cmd *cobra.Command, kubeconfigPath strin
|
|||
}
|
||||
|
||||
suggestions := []string{}
|
||||
uniqClusters := map[string]struct{}{}
|
||||
for _, ctx := range config.Contexts {
|
||||
clusterName := ctx.Cluster
|
||||
if strings.HasPrefix(clusterName, toComplete) {
|
||||
if _, ok := uniqClusters[clusterName]; !ok {
|
||||
suggestions = append(suggestions, ctx.Cluster)
|
||||
uniqClusters[clusterName] = struct{}{}
|
||||
uniqContexts := map[string]struct{}{}
|
||||
for ctxName := range config.Contexts {
|
||||
if strings.HasPrefix(ctxName, toComplete) {
|
||||
if _, ok := uniqContexts[ctxName]; !ok {
|
||||
suggestions = append(suggestions, ctxName)
|
||||
uniqContexts[ctxName] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue