mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Merge pull request #26598 from janetkuo/3rd-party-error-logs
Automatic merge from submit-queue Add more information when throwing errors in discoverying 3rd party resources #26425 []()
This commit is contained in:
@@ -253,14 +253,14 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
|
||||
// have been dynamically added to the apiserver
|
||||
Object: func(discoverDynamicAPIs bool) (meta.RESTMapper, runtime.ObjectTyper) {
|
||||
cfg, err := clientConfig.ClientConfig()
|
||||
CheckErr(err)
|
||||
checkErrWithPrefix("failed to get client config: ", err)
|
||||
cmdApiVersion := unversioned.GroupVersion{}
|
||||
if cfg.GroupVersion != nil {
|
||||
cmdApiVersion = *cfg.GroupVersion
|
||||
}
|
||||
if discoverDynamicAPIs {
|
||||
client, err := clients.ClientForVersion(&unversioned.GroupVersion{Version: "v1"})
|
||||
CheckErr(err)
|
||||
checkErrWithPrefix("failed to find client for version v1: ", err)
|
||||
|
||||
var versions []unversioned.GroupVersion
|
||||
var gvks []unversioned.GroupVersionKind
|
||||
@@ -274,7 +274,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckErr(err)
|
||||
checkErrWithPrefix("failed to get third-party group versions: ", err)
|
||||
if len(versions) > 0 {
|
||||
priorityMapper, ok := mapper.RESTMapper.(meta.PriorityRESTMapper)
|
||||
if !ok {
|
||||
@@ -294,7 +294,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
|
||||
preferredExternalVersion := versionList[0]
|
||||
|
||||
thirdPartyMapper, err := kubectl.NewThirdPartyResourceMapper(versionList, getGroupVersionKinds(gvks, group))
|
||||
CheckErr(err)
|
||||
checkErrWithPrefix("failed to create third party resource mapper: ", err)
|
||||
accessor := meta.NewAccessor()
|
||||
groupMeta := apimachinery.GroupMeta{
|
||||
GroupVersion: preferredExternalVersion,
|
||||
@@ -304,7 +304,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
|
||||
InterfacesFor: makeInterfacesFor(versionList),
|
||||
}
|
||||
|
||||
CheckErr(registered.RegisterGroup(groupMeta))
|
||||
checkErrWithPrefix("failed to register group: ", registered.RegisterGroup(groupMeta))
|
||||
registered.AddThirdPartyAPIGroupVersions(versionList...)
|
||||
multiMapper = append(meta.MultiRESTMapper{thirdPartyMapper}, multiMapper...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user