mechanical repercussions
This commit is contained in:
@@ -18,7 +18,7 @@ limitations under the License.
|
||||
//
|
||||
// TODO(lavalamp): this package is a huge disaster at the moment. I intend to
|
||||
// refactor. All code currently using this package should change:
|
||||
// 1. Declare your own registered.APIGroupRegistrationManager in your own test code.
|
||||
// 1. Declare your own api.Registry.APIGroupRegistrationManager in your own test code.
|
||||
// 2. Import the relevant install packages.
|
||||
// 3. Register the types you need, from the announced.APIGroupAnnouncementManager.
|
||||
package testapi
|
||||
@@ -31,7 +31,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/recognizer"
|
||||
@@ -139,7 +138,7 @@ func init() {
|
||||
}
|
||||
|
||||
if _, ok := Groups[api.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: api.GroupName, Version: registered.GroupOrDie(api.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: api.GroupName, Version: api.Registry.GroupOrDie(api.GroupName).GroupVersion.Version}
|
||||
Groups[api.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: api.SchemeGroupVersion,
|
||||
@@ -148,7 +147,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[extensions.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: extensions.GroupName, Version: registered.GroupOrDie(extensions.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: extensions.GroupName, Version: api.Registry.GroupOrDie(extensions.GroupName).GroupVersion.Version}
|
||||
Groups[extensions.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: extensions.SchemeGroupVersion,
|
||||
@@ -164,7 +163,7 @@ func init() {
|
||||
}
|
||||
internalTypes[k] = t
|
||||
}
|
||||
externalGroupVersion := schema.GroupVersion{Group: autoscaling.GroupName, Version: registered.GroupOrDie(autoscaling.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: autoscaling.GroupName, Version: api.Registry.GroupOrDie(autoscaling.GroupName).GroupVersion.Version}
|
||||
Groups[autoscaling.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: extensions.SchemeGroupVersion,
|
||||
@@ -180,7 +179,7 @@ func init() {
|
||||
break
|
||||
}
|
||||
}
|
||||
externalGroupVersion := schema.GroupVersion{Group: autoscaling.GroupName, Version: registered.GroupOrDie(autoscaling.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: autoscaling.GroupName, Version: api.Registry.GroupOrDie(autoscaling.GroupName).GroupVersion.Version}
|
||||
Groups[autoscaling.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: autoscaling.SchemeGroupVersion,
|
||||
@@ -189,7 +188,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[batch.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: batch.GroupName, Version: registered.GroupOrDie(batch.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: batch.GroupName, Version: api.Registry.GroupOrDie(batch.GroupName).GroupVersion.Version}
|
||||
Groups[batch.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: batch.SchemeGroupVersion,
|
||||
@@ -198,7 +197,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[apps.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: apps.GroupName, Version: registered.GroupOrDie(apps.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: apps.GroupName, Version: api.Registry.GroupOrDie(apps.GroupName).GroupVersion.Version}
|
||||
Groups[apps.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: extensions.SchemeGroupVersion,
|
||||
@@ -207,7 +206,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[policy.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: policy.GroupName, Version: registered.GroupOrDie(policy.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: policy.GroupName, Version: api.Registry.GroupOrDie(policy.GroupName).GroupVersion.Version}
|
||||
Groups[policy.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: policy.SchemeGroupVersion,
|
||||
@@ -216,7 +215,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[federation.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: federation.GroupName, Version: registered.GroupOrDie(federation.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: federation.GroupName, Version: api.Registry.GroupOrDie(federation.GroupName).GroupVersion.Version}
|
||||
Groups[federation.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: federation.SchemeGroupVersion,
|
||||
@@ -225,7 +224,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[rbac.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: rbac.GroupName, Version: registered.GroupOrDie(rbac.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: rbac.GroupName, Version: api.Registry.GroupOrDie(rbac.GroupName).GroupVersion.Version}
|
||||
Groups[rbac.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: rbac.SchemeGroupVersion,
|
||||
@@ -234,7 +233,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[storage.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: storage.GroupName, Version: registered.GroupOrDie(storage.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: storage.GroupName, Version: api.Registry.GroupOrDie(storage.GroupName).GroupVersion.Version}
|
||||
Groups[storage.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: storage.SchemeGroupVersion,
|
||||
@@ -243,7 +242,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[certificates.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: certificates.GroupName, Version: registered.GroupOrDie(certificates.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: certificates.GroupName, Version: api.Registry.GroupOrDie(certificates.GroupName).GroupVersion.Version}
|
||||
Groups[certificates.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: certificates.SchemeGroupVersion,
|
||||
@@ -252,7 +251,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[imagepolicy.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: imagepolicy.GroupName, Version: registered.GroupOrDie(imagepolicy.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: imagepolicy.GroupName, Version: api.Registry.GroupOrDie(imagepolicy.GroupName).GroupVersion.Version}
|
||||
Groups[imagepolicy.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: imagepolicy.SchemeGroupVersion,
|
||||
@@ -261,7 +260,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[authorization.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: authorization.GroupName, Version: registered.GroupOrDie(authorization.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: authorization.GroupName, Version: api.Registry.GroupOrDie(authorization.GroupName).GroupVersion.Version}
|
||||
Groups[authorization.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: authorization.SchemeGroupVersion,
|
||||
@@ -270,7 +269,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
if _, ok := Groups[kubeadm.GroupName]; !ok {
|
||||
externalGroupVersion := schema.GroupVersion{Group: kubeadm.GroupName, Version: registered.GroupOrDie(kubeadm.GroupName).GroupVersion.Version}
|
||||
externalGroupVersion := schema.GroupVersion{Group: kubeadm.GroupName, Version: api.Registry.GroupOrDie(kubeadm.GroupName).GroupVersion.Version}
|
||||
Groups[kubeadm.GroupName] = TestGroup{
|
||||
externalGroupVersion: externalGroupVersion,
|
||||
internalGroupVersion: kubeadm.SchemeGroupVersion,
|
||||
@@ -358,7 +357,7 @@ func (g TestGroup) StorageCodec() runtime.Codec {
|
||||
// Converter returns the api.Scheme for the API version to test against, as set by the
|
||||
// KUBE_TEST_API env var.
|
||||
func (g TestGroup) Converter() runtime.ObjectConvertor {
|
||||
interfaces, err := registered.GroupOrDie(g.externalGroupVersion.Group).InterfacesFor(g.externalGroupVersion)
|
||||
interfaces, err := api.Registry.GroupOrDie(g.externalGroupVersion.Group).InterfacesFor(g.externalGroupVersion)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -368,7 +367,7 @@ func (g TestGroup) Converter() runtime.ObjectConvertor {
|
||||
// MetadataAccessor returns the MetadataAccessor for the API version to test against,
|
||||
// as set by the KUBE_TEST_API env var.
|
||||
func (g TestGroup) MetadataAccessor() meta.MetadataAccessor {
|
||||
interfaces, err := registered.GroupOrDie(g.externalGroupVersion.Group).InterfacesFor(g.externalGroupVersion)
|
||||
interfaces, err := api.Registry.GroupOrDie(g.externalGroupVersion.Group).InterfacesFor(g.externalGroupVersion)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -432,7 +431,7 @@ func (g TestGroup) ResourcePath(resource, namespace, name string) string {
|
||||
}
|
||||
|
||||
func (g TestGroup) RESTMapper() meta.RESTMapper {
|
||||
return registered.RESTMapper()
|
||||
return api.Registry.RESTMapper()
|
||||
}
|
||||
|
||||
// ExternalGroupVersions returns all external group versions allowed for the server.
|
||||
|
Reference in New Issue
Block a user