mirror of https://github.com/k3s-io/k3s
Prevent caching empty discovery docs
parent
81d01a84e0
commit
091aac7e1e
|
@ -75,6 +75,11 @@ func (d *CachedDiscoveryClient) ServerResourcesForGroupVersion(groupVersion stri
|
||||||
|
|
||||||
liveResources, err := d.delegate.ServerResourcesForGroupVersion(groupVersion)
|
liveResources, err := d.delegate.ServerResourcesForGroupVersion(groupVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
glog.V(3).Infof("skipped caching discovery info due to %v", err)
|
||||||
|
return liveResources, err
|
||||||
|
}
|
||||||
|
if liveResources == nil || len(liveResources.APIResources) == 0 {
|
||||||
|
glog.V(3).Infof("skipped caching discovery info, no resources found")
|
||||||
return liveResources, err
|
return liveResources, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +122,11 @@ func (d *CachedDiscoveryClient) ServerGroups() (*metav1.APIGroupList, error) {
|
||||||
|
|
||||||
liveGroups, err := d.delegate.ServerGroups()
|
liveGroups, err := d.delegate.ServerGroups()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
glog.V(3).Infof("skipped caching discovery info due to %v", err)
|
||||||
|
return liveGroups, err
|
||||||
|
}
|
||||||
|
if liveGroups == nil || len(liveGroups.Groups) == 0 {
|
||||||
|
glog.V(3).Infof("skipped caching discovery info, no groups found")
|
||||||
return liveGroups, err
|
return liveGroups, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ func (c *fakeDiscoveryClient) ServerGroups() (*metav1.APIGroupList, error) {
|
||||||
func (c *fakeDiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) {
|
func (c *fakeDiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) {
|
||||||
c.resourceCalls = c.resourceCalls + 1
|
c.resourceCalls = c.resourceCalls + 1
|
||||||
if groupVersion == "a/v1" {
|
if groupVersion == "a/v1" {
|
||||||
return &metav1.APIResourceList{}, nil
|
return &metav1.APIResourceList{APIResources: []metav1.APIResource{{Name: "widgets", Kind: "Widget"}}}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, errors.NewNotFound(schema.GroupResource{}, "")
|
return nil, errors.NewNotFound(schema.GroupResource{}, "")
|
||||||
|
|
Loading…
Reference in New Issue