Skip to content

Commit

Permalink
Handle invalid API resources in discovery
Browse files Browse the repository at this point in the history
Fixes #4
  • Loading branch information
Blake Barnett committed Feb 18, 2023
1 parent 6d0e8cf commit 56ae322
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ func decodeIntoTable(obj runtime.Object) (*metav1.Table, error) {

// List returns a list of objects that matches the provided options on the
// server.
//
//nolint:funlen,gocognit
func (c *client) List(ctx context.Context, opts ListOptions) (*unstructuredv1.UnstructuredList, error) {
klog.V(4).Infof("List with options: %+v", opts)
Expand Down Expand Up @@ -325,7 +326,11 @@ func (c *client) List(ctx context.Context, opts ListOptions) (*unstructuredv1.Un
func (c *client) GetAPIResources(_ context.Context) ([]APIResource, error) {
rls, err := c.discoveryClient.ServerPreferredResources()
if err != nil {
return nil, err
if discovery.IsGroupDiscoveryFailedError(err) {
klog.V(3).Info("Ignoring invalid resources")
} else {
return nil, err
}
}

apis := []APIResource{}
Expand Down

0 comments on commit 56ae322

Please sign in to comment.