Upgrade k8s package verison (#5358)
* upgrade k8s package version Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io> * Script upgrade and code formatting. Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io> Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
This commit is contained in:
4
vendor/k8s.io/client-go/restmapper/discovery.go
generated
vendored
4
vendor/k8s.io/client-go/restmapper/discovery.go
generated
vendored
@@ -205,7 +205,7 @@ func (d *DeferredDiscoveryRESTMapper) getDelegate() (meta.RESTMapper, error) {
|
||||
}
|
||||
|
||||
d.delegate = NewDiscoveryRESTMapper(groupResources)
|
||||
return d.delegate, err
|
||||
return d.delegate, nil
|
||||
}
|
||||
|
||||
// Reset resets the internally cached Discovery information and will
|
||||
@@ -335,4 +335,4 @@ func (d *DeferredDiscoveryRESTMapper) String() string {
|
||||
}
|
||||
|
||||
// Make sure it satisfies the interface
|
||||
var _ meta.RESTMapper = &DeferredDiscoveryRESTMapper{}
|
||||
var _ meta.ResettableRESTMapper = &DeferredDiscoveryRESTMapper{}
|
||||
|
||||
19
vendor/k8s.io/client-go/restmapper/shortcut.go
generated
vendored
19
vendor/k8s.io/client-go/restmapper/shortcut.go
generated
vendored
@@ -34,7 +34,7 @@ type shortcutExpander struct {
|
||||
discoveryClient discovery.DiscoveryInterface
|
||||
}
|
||||
|
||||
var _ meta.RESTMapper = &shortcutExpander{}
|
||||
var _ meta.ResettableRESTMapper = shortcutExpander{}
|
||||
|
||||
// NewShortcutExpander wraps a restmapper in a layer that expands shortcuts found via discovery
|
||||
func NewShortcutExpander(delegate meta.RESTMapper, client discovery.DiscoveryInterface) meta.RESTMapper {
|
||||
@@ -43,7 +43,18 @@ func NewShortcutExpander(delegate meta.RESTMapper, client discovery.DiscoveryInt
|
||||
|
||||
// KindFor fulfills meta.RESTMapper
|
||||
func (e shortcutExpander) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) {
|
||||
return e.RESTMapper.KindFor(e.expandResourceShortcut(resource))
|
||||
// expandResourceShortcut works with current API resources as read from discovery cache.
|
||||
// In case of new CRDs this means we potentially don't have current state of discovery.
|
||||
// In the current wiring in k8s.io/cli-runtime/pkg/genericclioptions/config_flags.go#toRESTMapper,
|
||||
// we are using DeferredDiscoveryRESTMapper which on KindFor failure will clear the
|
||||
// cache and fetch all data from a cluster (see vendor/k8s.io/client-go/restmapper/discovery.go#KindFor).
|
||||
// Thus another call to expandResourceShortcut, after a NoMatchError should successfully
|
||||
// read Kind to the user or an error.
|
||||
gvk, err := e.RESTMapper.KindFor(e.expandResourceShortcut(resource))
|
||||
if meta.IsNoMatchError(err) {
|
||||
return e.RESTMapper.KindFor(e.expandResourceShortcut(resource))
|
||||
}
|
||||
return gvk, err
|
||||
}
|
||||
|
||||
// KindsFor fulfills meta.RESTMapper
|
||||
@@ -164,6 +175,10 @@ func (e shortcutExpander) expandResourceShortcut(resource schema.GroupVersionRes
|
||||
return resource
|
||||
}
|
||||
|
||||
func (e shortcutExpander) Reset() {
|
||||
meta.MaybeResetRESTMapper(e.RESTMapper)
|
||||
}
|
||||
|
||||
// ResourceShortcuts represents a structure that holds the information how to
|
||||
// transition from resource's shortcut to its full name.
|
||||
type resourceShortcuts struct {
|
||||
|
||||
Reference in New Issue
Block a user