mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
add a union category expander
This commit is contained in:
parent
6b78eeca84
commit
486d8ef229
@ -79,6 +79,33 @@ func (e discoveryFilteredExpander) Expand(category string) ([]schema.GroupResour
|
|||||||
return available, ok
|
return available, ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UnionCategoryExpander []CategoryExpander
|
||||||
|
|
||||||
|
func (u UnionCategoryExpander) Expand(category string) ([]schema.GroupResource, bool) {
|
||||||
|
ret := []schema.GroupResource{}
|
||||||
|
ok := false
|
||||||
|
|
||||||
|
for _, expansion := range u {
|
||||||
|
curr, currOk := expansion.Expand(category)
|
||||||
|
|
||||||
|
for _, currGR := range curr {
|
||||||
|
found := false
|
||||||
|
for _, existing := range ret {
|
||||||
|
if existing == currGR {
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
ret = append(ret, currGR)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ok = ok || currOk
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret, ok
|
||||||
|
}
|
||||||
|
|
||||||
// legacyUserResources are the resource names that apply to the primary, user facing resources used by
|
// legacyUserResources are the resource names that apply to the primary, user facing resources used by
|
||||||
// client tools. They are in deletion-first order - dependent resources should be last.
|
// client tools. They are in deletion-first order - dependent resources should be last.
|
||||||
// Should remain exported in order to expose a current list of resources to downstream
|
// Should remain exported in order to expose a current list of resources to downstream
|
||||||
|
Loading…
Reference in New Issue
Block a user