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

[Improvement] Fix partially the throtteling bug. #607

Merged
merged 9 commits into from
Nov 23, 2021
12 changes: 4 additions & 8 deletions internal/k8sutil/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,13 @@ func isKubeMetaKind(kind string) bool {
// ResourceExists returns true if the given resource kind exists
// in the given api groupversion
func ResourceExists(dc discovery.DiscoveryInterface, apiGroupVersion, kind string) (bool, error) {
_, apiLists, err := dc.ServerGroupsAndResources()
apiList, err := dc.ServerResourcesForGroupVersion(apiGroupVersion)
if err != nil {
return false, err
}
for _, apiList := range apiLists {
if apiList.GroupVersion == apiGroupVersion {
for _, r := range apiList.APIResources {
if r.Kind == kind {
return true, nil
}
}
for _, r := range apiList.APIResources {
if r.Kind == kind {
return true, nil
}
}
return false, nil
Expand Down