Skip to content

Commit

Permalink
Handle invalid API resources in discovery (#1758)
Browse files Browse the repository at this point in the history
  • Loading branch information
wiltonsr authored Oct 27, 2023
1 parent e146848 commit cd78251
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/util/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package util
import (
"strings"

"github.com/golang/glog"
"k8s.io/client-go/discovery"
"k8s.io/client-go/kubernetes"
)

Expand All @@ -44,7 +46,11 @@ func getPreferredAvailableAPIs(client kubernetes.Interface, kind string) (Capabi
discoveryclient := client.Discovery()
lists, err := discoveryclient.ServerPreferredResources()
if err != nil {
return nil, err
if discovery.IsGroupDiscoveryFailedError(err) {
glog.Infof("There is an orphaned API service. Server reports: %s", err)
} else {
return nil, err
}
}

caps := Capabilities{}
Expand Down

0 comments on commit cd78251

Please sign in to comment.