1
1
package install
2
2
3
3
import (
4
+ kapi "k8s.io/kubernetes/pkg/api"
5
+ "k8s.io/kubernetes/pkg/api/unversioned"
4
6
"k8s.io/kubernetes/pkg/apimachinery/announced"
7
+ "k8s.io/kubernetes/pkg/runtime"
8
+ "k8s.io/kubernetes/pkg/watch/versioned"
5
9
6
10
"github.com/openshift/origin/pkg/build/api"
7
11
"github.com/openshift/origin/pkg/build/api/v1"
@@ -12,15 +16,63 @@ const importPrefix = "github.com/openshift/origin/pkg/build/api"
12
16
func init () {
13
17
if err := announced .NewGroupMetaFactory (
14
18
& announced.GroupMetaFactoryArgs {
15
- GroupName : api .GroupName ,
16
- VersionPreferenceOrder : []string {v1 .SchemeGroupVersion .Version },
17
- ImportPrefix : importPrefix ,
18
- // AddInternalObjectsToScheme: api.AddToScheme ,
19
+ GroupName : api .GroupName ,
20
+ VersionPreferenceOrder : []string {v1 .SchemeGroupVersion .Version },
21
+ ImportPrefix : importPrefix ,
22
+ AddInternalObjectsToScheme : addKnownInternalTypes ,
19
23
},
20
24
announced.VersionToSchemeFunc {
21
- v1 .SchemeGroupVersion .Version : v1 . AddToScheme ,
25
+ v1 .SchemeGroupVersion .Version : addKnownExternalTypes ,
22
26
},
23
27
).Announce ().RegisterAndEnable (); err != nil {
24
28
panic (err )
25
29
}
26
30
}
31
+
32
+ func addKnownExternalTypes (scheme * runtime.Scheme ) error {
33
+ types := []runtime.Object {
34
+ & v1.Build {},
35
+ & v1.BuildList {},
36
+ & v1.BuildConfig {},
37
+ & v1.BuildConfigList {},
38
+ & v1.BuildLog {},
39
+ & v1.BuildRequest {},
40
+ & v1.BuildLogOptions {},
41
+ & v1.BinaryBuildRequestOptions {},
42
+ }
43
+ scheme .AddKnownTypes (api .SchemeGroupVersion ,
44
+ append (types ,
45
+ & unversioned.Status {},
46
+ & kapi.ListOptions {},
47
+ & kapi.DeleteOptions {},
48
+ & kapi.ExportOptions {},
49
+ )... ,
50
+ )
51
+ versioned .AddToGroupVersion (scheme , v1 .SchemeGroupVersion )
52
+ scheme .AddKnownTypes (v1 .SchemeGroupVersion , types ... )
53
+ return nil
54
+ }
55
+
56
+ func addKnownInternalTypes (scheme * runtime.Scheme ) error {
57
+ types := []runtime.Object {
58
+ & api.Build {},
59
+ & api.BuildList {},
60
+ & api.BuildConfig {},
61
+ & api.BuildConfigList {},
62
+ & api.BuildLog {},
63
+ & api.BuildRequest {},
64
+ & api.BuildLogOptions {},
65
+ & api.BinaryBuildRequestOptions {},
66
+ }
67
+ scheme .AddKnownTypes (api .SchemeGroupVersion ,
68
+ append (types ,
69
+ & unversioned.Status {},
70
+ & kapi.ListOptions {},
71
+ & kapi.DeleteOptions {},
72
+ & kapi.ExportOptions {},
73
+ )... ,
74
+ )
75
+ versioned .AddToGroupVersion (scheme , api .SchemeGroupVersion )
76
+ scheme .AddKnownTypes (api .SchemeGroupVersion , types ... )
77
+ return nil
78
+ }
0 commit comments