Skip to content

Commit

Permalink
apigroups: adapt to new 1.6 style
Browse files Browse the repository at this point in the history
  • Loading branch information
sttts authored and deads2k committed Apr 27, 2017
1 parent 862a684 commit 64ffa5e
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 12 deletions.
10 changes: 9 additions & 1 deletion pkg/authorization/api/install/apigroup.go
Expand Up @@ -2,13 +2,21 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/authorization/api"
"github.com/openshift/origin/pkg/authorization/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -20,7 +28,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
10 changes: 9 additions & 1 deletion pkg/build/api/install/apigroup.go
Expand Up @@ -2,12 +2,20 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/build/api"
"github.com/openshift/origin/pkg/build/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -18,7 +26,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
10 changes: 9 additions & 1 deletion pkg/deploy/api/install/apigroup.go
Expand Up @@ -2,12 +2,20 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/deploy/api"
"github.com/openshift/origin/pkg/deploy/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -18,7 +26,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
9 changes: 8 additions & 1 deletion pkg/image/api/install/apigroup.go
Expand Up @@ -2,8 +2,10 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/image/api"
"github.com/openshift/origin/pkg/image/api/docker10"
Expand All @@ -12,6 +14,11 @@ import (
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -37,7 +44,7 @@ func installApiGroup() {
dockerpre012.SchemeGroupVersion.Version: dockerpre012.AddToScheme,
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
10 changes: 9 additions & 1 deletion pkg/oauth/api/install/apigroup.go
Expand Up @@ -2,13 +2,21 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/oauth/api"
"github.com/openshift/origin/pkg/oauth/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -20,7 +28,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
10 changes: 9 additions & 1 deletion pkg/project/api/install/apigroup.go
Expand Up @@ -2,13 +2,21 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/project/api"
"github.com/openshift/origin/pkg/project/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -20,7 +28,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
10 changes: 9 additions & 1 deletion pkg/quota/api/install/apigroup.go
Expand Up @@ -2,13 +2,21 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/quota/api"
"github.com/openshift/origin/pkg/quota/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -20,7 +28,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
10 changes: 9 additions & 1 deletion pkg/route/api/install/apigroup.go
Expand Up @@ -2,12 +2,20 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/route/api"
"github.com/openshift/origin/pkg/route/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -18,7 +26,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
10 changes: 9 additions & 1 deletion pkg/sdn/api/install/apigroup.go
Expand Up @@ -2,13 +2,21 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/sdn/api"
"github.com/openshift/origin/pkg/sdn/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -20,7 +28,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
10 changes: 9 additions & 1 deletion pkg/security/api/install/apigroup.go
Expand Up @@ -2,12 +2,20 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/security/api"
"github.com/openshift/origin/pkg/security/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -18,7 +26,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
10 changes: 9 additions & 1 deletion pkg/template/api/install/apigroup.go
Expand Up @@ -2,13 +2,21 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/template/api"
"github.com/openshift/origin/pkg/template/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -20,7 +28,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.LegacySchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}
10 changes: 9 additions & 1 deletion pkg/user/api/install/apigroup.go
Expand Up @@ -2,13 +2,21 @@ package install

import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
kapi "k8s.io/kubernetes/pkg/api"

"github.com/openshift/origin/pkg/user/api"
"github.com/openshift/origin/pkg/user/api/v1"
)

func installApiGroup() {
Install(kapi.GroupFactoryRegistry, kapi.Registry, kapi.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: api.GroupName,
Expand All @@ -20,7 +28,7 @@ func installApiGroup() {
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
},
).Announce().RegisterAndEnable(); err != nil {
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}

0 comments on commit 64ffa5e

Please sign in to comment.