mirror of https://github.com/k3s-io/k3s
Merge pull request #50094 from sttts/sttts-no-importprefix
Automatic merge from submit-queue (batch tested with PRs 50094, 48966, 49478, 50593, 49140) apimachinery: remove pre-apigroups import path logic Replacing #50093.pull/6/head
commit
9f902fef24
|
@ -35,7 +35,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: kubeadm.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm",
|
||||
AddInternalObjectsToScheme: kubeadm.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -35,7 +35,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: core.GroupName,
|
||||
VersionPreferenceOrder: []string{corev1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/kubernetes/federation/apis/core",
|
||||
AddInternalObjectsToScheme: core.AddToScheme,
|
||||
RootScopedKinds: sets.NewString(
|
||||
"Namespace",
|
||||
|
|
|
@ -37,7 +37,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: federation.GroupName,
|
||||
VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/kubernetes/federation/apis/federation",
|
||||
AddInternalObjectsToScheme: federation.AddToScheme,
|
||||
RootScopedKinds: sets.NewString(
|
||||
"Cluster",
|
||||
|
|
|
@ -37,7 +37,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: api.GroupName,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/core",
|
||||
AddInternalObjectsToScheme: api.AddToScheme,
|
||||
RootScopedKinds: sets.NewString(
|
||||
"Node",
|
||||
|
|
|
@ -38,7 +38,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: admission.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/admission",
|
||||
RootScopedKinds: sets.NewString("AdmissionReview"),
|
||||
AddInternalObjectsToScheme: admission.AddToScheme,
|
||||
},
|
||||
|
|
|
@ -37,7 +37,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
GroupName: admissionregistration.GroupName,
|
||||
RootScopedKinds: sets.NewString("InitializerConfiguration", "ExternalAdmissionHookConfiguration"),
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/admissionregistration",
|
||||
AddInternalObjectsToScheme: admissionregistration.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -38,7 +38,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: apps.GroupName,
|
||||
VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version, v1beta2.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/apps",
|
||||
AddInternalObjectsToScheme: apps.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -39,7 +39,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: authentication.GroupName,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version, v1beta1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/authentication",
|
||||
RootScopedKinds: sets.NewString("TokenReview"),
|
||||
AddInternalObjectsToScheme: authentication.AddToScheme,
|
||||
},
|
||||
|
|
|
@ -39,7 +39,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: authorization.GroupName,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version, v1beta1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/authorization",
|
||||
RootScopedKinds: sets.NewString("SubjectAccessReview", "SelfSubjectAccessReview"),
|
||||
AddInternalObjectsToScheme: authorization.AddToScheme,
|
||||
},
|
||||
|
|
|
@ -38,7 +38,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: autoscaling.GroupName,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version, v2alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/autoscaling",
|
||||
AddInternalObjectsToScheme: autoscaling.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -38,7 +38,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: batch.GroupName,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version, v2alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/batch",
|
||||
AddInternalObjectsToScheme: batch.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -38,7 +38,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: certificates.GroupName,
|
||||
VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/certificates",
|
||||
RootScopedKinds: sets.NewString("CertificateSigningRequest"),
|
||||
AddInternalObjectsToScheme: certificates.AddToScheme,
|
||||
},
|
||||
|
|
|
@ -37,7 +37,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: componentconfig.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/kubernetes/pkg/apis/componentconfig",
|
||||
AddInternalObjectsToScheme: componentconfig.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -38,7 +38,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: extensions.GroupName,
|
||||
VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/extensions",
|
||||
RootScopedKinds: sets.NewString("PodSecurityPolicy", "ThirdPartyResource"),
|
||||
AddInternalObjectsToScheme: extensions.AddToScheme,
|
||||
},
|
||||
|
|
|
@ -38,7 +38,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: imagepolicy.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/imagepolicy",
|
||||
RootScopedKinds: sets.NewString("ImageReview"),
|
||||
AddInternalObjectsToScheme: imagepolicy.AddToScheme,
|
||||
},
|
||||
|
|
|
@ -37,7 +37,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: networking.GroupName,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/networking",
|
||||
AddInternalObjectsToScheme: networking.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -37,7 +37,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: policy.GroupName,
|
||||
VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/policy",
|
||||
AddInternalObjectsToScheme: policy.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -50,7 +50,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
// 1.10 (once all stored objects are at v1):
|
||||
// * remove v1alpha1
|
||||
VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version, v1.SchemeGroupVersion.Version, v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/rbac",
|
||||
RootScopedKinds: sets.NewString("ClusterRole", "ClusterRoleBinding"),
|
||||
AddInternalObjectsToScheme: rbac.AddToScheme,
|
||||
},
|
||||
|
|
|
@ -38,7 +38,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: scheduling.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/scheduling",
|
||||
RootScopedKinds: sets.NewString("PriorityClass"),
|
||||
AddInternalObjectsToScheme: scheduling.AddToScheme,
|
||||
},
|
||||
|
|
|
@ -37,7 +37,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: settings.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/settings",
|
||||
AddInternalObjectsToScheme: settings.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -39,7 +39,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: storage.GroupName,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version, v1beta1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/api/storage",
|
||||
RootScopedKinds: sets.NewString("StorageClass"),
|
||||
AddInternalObjectsToScheme: storage.AddToScheme,
|
||||
},
|
||||
|
|
|
@ -32,7 +32,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: internalapi.GroupName,
|
||||
VersionPreferenceOrder: []string{versionedapi.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/kubernetes/plugin/pkg/admission/podtolerationrestriction/apis/podtolerationrestriction",
|
||||
AddInternalObjectsToScheme: internalapi.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -32,7 +32,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: resourcequotaapi.GroupName,
|
||||
VersionPreferenceOrder: []string{resourcequotav1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/kubernetes/plugin/pkg/admission/resourcequota/apis/resourcequota",
|
||||
AddInternalObjectsToScheme: resourcequotaapi.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -32,7 +32,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
GroupName: apiextensions.GroupName,
|
||||
RootScopedKinds: sets.NewString("CustomResourceDefinition"),
|
||||
VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/apiextensions-apiserver/pkg/apis/apiextension",
|
||||
AddInternalObjectsToScheme: apiextensions.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -28,7 +28,6 @@ go_test(
|
|||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"default.go",
|
||||
"doc.go",
|
||||
"errors.go",
|
||||
"firsthit_restmapper.go",
|
||||
|
@ -50,7 +49,6 @@ go_library(
|
|||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
Copyright 2015 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package meta
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
)
|
||||
|
||||
// NewDefaultRESTMapperFromScheme instantiates a DefaultRESTMapper based on types registered in the given scheme.
|
||||
func NewDefaultRESTMapperFromScheme(defaultGroupVersions []schema.GroupVersion, interfacesFunc VersionInterfacesFunc,
|
||||
importPathPrefix string, ignoredKinds, rootScoped sets.String, scheme *runtime.Scheme) *DefaultRESTMapper {
|
||||
|
||||
mapper := NewDefaultRESTMapper(defaultGroupVersions, interfacesFunc)
|
||||
// enumerate all supported versions, get the kinds, and register with the mapper how to address
|
||||
// our resources.
|
||||
for _, gv := range defaultGroupVersions {
|
||||
for kind, oType := range scheme.KnownTypes(gv) {
|
||||
gvk := gv.WithKind(kind)
|
||||
// TODO: Remove import path check.
|
||||
// We check the import path because we currently stuff both "api" and "extensions" objects
|
||||
// into the same group within Scheme since Scheme has no notion of groups yet.
|
||||
if !strings.Contains(oType.PkgPath(), importPathPrefix) || ignoredKinds.Has(kind) {
|
||||
continue
|
||||
}
|
||||
scope := RESTScopeNamespace
|
||||
if rootScoped.Has(kind) {
|
||||
scope = RESTScopeRoot
|
||||
}
|
||||
mapper.Add(gvk, scope)
|
||||
}
|
||||
}
|
||||
return mapper
|
||||
}
|
|
@ -30,7 +30,6 @@ func TestFactoryRegistry(t *testing.T) {
|
|||
if err := regA.AnnounceGroup(&GroupMetaFactoryArgs{
|
||||
GroupName: "foo",
|
||||
VersionPreferenceOrder: []string{"v2", "v1"},
|
||||
ImportPrefix: "pkg/apis/foo",
|
||||
RootScopedKinds: sets.NewString("namespaces"),
|
||||
}); err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
|
@ -52,7 +51,6 @@ func TestFactoryRegistry(t *testing.T) {
|
|||
&GroupMetaFactoryArgs{
|
||||
GroupName: "foo",
|
||||
VersionPreferenceOrder: []string{"v2", "v1"},
|
||||
ImportPrefix: "pkg/apis/foo",
|
||||
RootScopedKinds: sets.NewString("namespaces"),
|
||||
},
|
||||
VersionToSchemeFunc{"v1": nil, "v2": nil},
|
||||
|
|
|
@ -47,10 +47,6 @@ type GroupMetaFactoryArgs struct {
|
|||
// example: 'servicecatalog.k8s.io'
|
||||
GroupName string
|
||||
VersionPreferenceOrder []string
|
||||
// ImportPrefix is the base go package of the API-Group
|
||||
//
|
||||
// example: 'k8s.io/kubernetes/pkg/apis/autoscaling'
|
||||
ImportPrefix string
|
||||
// RootScopedKinds are resources that are not namespaced.
|
||||
RootScopedKinds sets.String // nil is allowed
|
||||
IgnoredKinds sets.String // nil is allowed
|
||||
|
@ -176,14 +172,21 @@ func (gmf *GroupMetaFactory) newRESTMapper(scheme *runtime.Scheme, externalVersi
|
|||
ignoredKinds = gmf.GroupArgs.IgnoredKinds
|
||||
}
|
||||
|
||||
return meta.NewDefaultRESTMapperFromScheme(
|
||||
externalVersions,
|
||||
groupMeta.InterfacesFor,
|
||||
gmf.GroupArgs.ImportPrefix,
|
||||
ignoredKinds,
|
||||
rootScoped,
|
||||
scheme,
|
||||
)
|
||||
mapper := meta.NewDefaultRESTMapper(externalVersions, groupMeta.InterfacesFor)
|
||||
for _, gv := range externalVersions {
|
||||
for kind := range scheme.KnownTypes(gv) {
|
||||
if ignoredKinds.Has(kind) {
|
||||
continue
|
||||
}
|
||||
scope := meta.RESTScopeNamespace
|
||||
if rootScoped.Has(kind) {
|
||||
scope = meta.RESTScopeRoot
|
||||
}
|
||||
mapper.Add(gv.WithKind(kind), scope)
|
||||
}
|
||||
}
|
||||
|
||||
return mapper
|
||||
}
|
||||
|
||||
// Enable enables group versions that are allowed, adds methods to the scheme, etc.
|
||||
|
|
|
@ -32,7 +32,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: testapigroup.GroupName,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/apimachinery/pkg/apis/testapigroup",
|
||||
AddInternalObjectsToScheme: testapigroup.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -32,7 +32,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
GroupName: apiserver.GroupName,
|
||||
RootScopedKinds: sets.NewString("APIService"),
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/apiserver/pkg/apis/apiserver",
|
||||
AddInternalObjectsToScheme: apiserver.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -33,7 +33,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: audit.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/apiserver/pkg/apis/audit",
|
||||
// Any Kind that is not namespaced must be cluster scoped.
|
||||
RootScopedKinds: sets.NewString("Event", "Policy"),
|
||||
AddInternalObjectsToScheme: audit.AddToScheme,
|
||||
|
|
|
@ -32,7 +32,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: example.GroupName,
|
||||
VersionPreferenceOrder: []string{examplev1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/apiserver/pkg/apis/example",
|
||||
AddInternalObjectsToScheme: example.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -167,7 +167,10 @@ func TestInstallAPIGroups(t *testing.T) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
mapper := meta.NewDefaultRESTMapperFromScheme([]schema.GroupVersion{gv}, interfacesFor, "", sets.NewString(), sets.NewString(), scheme)
|
||||
mapper := meta.NewDefaultRESTMapper([]schema.GroupVersion{gv}, interfacesFor)
|
||||
for kind := range scheme.KnownTypes(gv) {
|
||||
mapper.Add(gv.WithKind(kind), meta.RESTScopeNamespace)
|
||||
}
|
||||
groupMeta := apimachinery.GroupMeta{
|
||||
GroupVersion: gv,
|
||||
GroupVersions: []schema.GroupVersion{gv},
|
||||
|
|
|
@ -32,7 +32,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
GroupName: apiregistration.GroupName,
|
||||
RootScopedKinds: sets.NewString("APIService"),
|
||||
VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/kube-aggregator/pkg/apis/apiregistration",
|
||||
AddInternalObjectsToScheme: apiregistration.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -32,7 +32,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: testgroup.SchemeGroupVersion.Group,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/kube-gen/test/apis/testgroup",
|
||||
AddInternalObjectsToScheme: testgroup.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -32,7 +32,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: custom_metrics.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/metrics/pkg/apis/custom_metrics",
|
||||
AddInternalObjectsToScheme: custom_metrics.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -33,7 +33,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: metrics.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/metrics/pkg/apis/metrics",
|
||||
RootScopedKinds: sets.NewString("NodeMetrics"),
|
||||
AddInternalObjectsToScheme: metrics.AddToScheme,
|
||||
},
|
||||
|
|
|
@ -32,7 +32,6 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
GroupName: wardle.GroupName,
|
||||
RootScopedKinds: sets.NewString("Fischer", "FischerList"),
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "k8s.io/sample-apiserver/pkg/apis/wardle",
|
||||
AddInternalObjectsToScheme: wardle.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -438,7 +438,7 @@ var ephemeralWhiteList = createEphemeralWhiteList(
|
|||
// --
|
||||
)
|
||||
|
||||
// Only add kinds to this list when there is no mapping from GVK to GVR (and thus there is no way to create the object)
|
||||
// Only add kinds to this list when there is no way to create the object
|
||||
var kindWhiteList = sets.NewString(
|
||||
// k8s.io/kubernetes/pkg/api/v1
|
||||
"DeleteOptions",
|
||||
|
@ -496,14 +496,14 @@ func TestEtcdStoragePath(t *testing.T) {
|
|||
kind := gvk.Kind
|
||||
pkgPath := apiType.PkgPath()
|
||||
|
||||
if kindWhiteList.Has(kind) {
|
||||
kindSeen.Insert(kind)
|
||||
continue
|
||||
}
|
||||
|
||||
mapping, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
|
||||
if err != nil {
|
||||
kindSeen.Insert(kind)
|
||||
if kindWhiteList.Has(kind) {
|
||||
// t.Logf("skipping test for %s from %s because its GVK %s is whitelisted and has no mapping", kind, pkgPath, gvk)
|
||||
} else {
|
||||
t.Errorf("no mapping found for %s from %s but its GVK %s is not whitelisted", kind, pkgPath, gvk)
|
||||
}
|
||||
t.Errorf("unexpected error getting mapping for %s from %s with GVK %s: %v", kind, pkgPath, gvk, err)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue