forked from openshift/origin
/
install.go
38 lines (34 loc) · 1.51 KB
/
install.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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/api/legacy"
oauthapi "github.com/openshift/origin/pkg/oauth/apis/oauth"
oauthapiv1 "github.com/openshift/origin/pkg/oauth/apis/oauth/v1"
)
func init() {
legacy.InstallLegacy(oauthapi.GroupName, oauthapi.AddToSchemeInCoreGroup, oauthapiv1.AddToSchemeInCoreGroup,
sets.NewString("OAuthAccessToken", "OAuthAuthorizeToken", "OAuthClient", "OAuthClientAuthorization"),
kapi.Registry, kapi.Scheme,
)
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: oauthapi.GroupName,
VersionPreferenceOrder: []string{oauthapiv1.SchemeGroupVersion.Version},
AddInternalObjectsToScheme: oauthapi.AddToScheme,
RootScopedKinds: sets.NewString("OAuthAccessToken", "OAuthAuthorizeToken", "OAuthClient", "OAuthClientAuthorization"),
},
announced.VersionToSchemeFunc{
oauthapiv1.SchemeGroupVersion.Version: oauthapiv1.AddToScheme,
},
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}