You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I use helm(v3.13.3)and client-go( 0.28.4)
when somehow get snapshot.storage.k8s.io/v1 from /apis ,
but when call xxx.snapshot.storage.k8s.io/v1 , k8s return 404
in this case , client-go may call the /apis and other API Server interfaces multiple times, leading to performance degradation, which is unnecessary.
and the reason is that:
client-go cache_discovery.go , when get servergroup details, and k8s return 404, then client-go will not write this 404 servergfroup resourcelist to cachefile
discovery/cached/disk/cached_discovery.go:70
The text was updated successfully, but these errors were encountered:
func (d *CachedDiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) {
filename := filepath.Join(d.cacheDirectory, groupVersion, "serverresources.json")
cachedBytes, err := d.getCachedFile(filename)
// don't fail on errors, we either don't have a file or won't be able to run the cached check. Either way we can fallback.
if err == nil {
cachedResources := &metav1.APIResourceList{}
if err := runtime.DecodeInto(scheme.Codecs.UniversalDecoder(), cachedBytes, cachedResources); err == nil {
klog.V(10).Infof("returning cached discovery info from %v", filename)
return cachedResources, nil
}
}
liveResources, err := d.delegate.ServerResourcesForGroupVersion(groupVersion)
if err != nil {
// will go here
klog.V(3).Infof("skipped caching discovery info due to %v", err)
return liveResources, err
}
if liveResources == nil || len(liveResources.APIResources) == 0 {
klog.V(3).Infof("skipped caching discovery info, no resources found")
return liveResources, err
}
if err := d.writeCachedFile(filename, liveResources); err != nil {
klog.V(1).Infof("failed to write cache to %v due to %v", filename, err)
}
return liveResources, nil
when I use helm(v3.13.3)and client-go( 0.28.4)
when somehow get snapshot.storage.k8s.io/v1 from /apis ,
but when call xxx.snapshot.storage.k8s.io/v1 , k8s return 404
in this case , client-go may call the /apis and other API Server interfaces multiple times, leading to performance degradation, which is unnecessary.
and the reason is that:
client-go cache_discovery.go , when get servergroup details, and k8s return 404, then client-go will not write this 404 servergfroup resourcelist to cachefile
discovery/cached/disk/cached_discovery.go:70
The text was updated successfully, but these errors were encountered: