Skip to content

Commit a074fae

Browse files
authored
Fix confusion with duplicate names (#65)
1 parent bcdaae0 commit a074fae

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmd/kubectl-tree/apis.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,16 @@ func apiNames(a metav1.APIResource, gv schema.GroupVersion) []string {
100100
// TODO(ahmetb): sometimes SingularName is empty (e.g. Deployment), use lowercase Kind as fallback - investigate why
101101
singularName = strings.ToLower(a.Kind)
102102
}
103+
names := []string{singularName}
104+
103105
pluralName := a.Name
106+
if singularName != pluralName {
107+
names = append(names, pluralName)
108+
}
109+
104110
shortNames := a.ShortNames
105-
names := append([]string{singularName, pluralName}, shortNames...)
111+
names = append(names, shortNames...)
112+
106113
for _, n := range names {
107114
fmtBare := n // e.g. deployment
108115
fmtWithGroup := strings.Join([]string{n, gv.Group}, ".") // e.g. deployment.apps

0 commit comments

Comments
 (0)