forked from openshift/machine-config-operator
/
register.go
53 lines (45 loc) · 1.45 KB
/
register.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var (
// GroupName is the group name of this api
GroupName = "machineconfiguration.openshift.io"
// GroupVersion is the version of this api group
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// Install is a function which adds this version to a scheme
Install = schemeBuilder.AddToScheme
// SchemeGroupVersion is DEPRECATED
SchemeGroupVersion = GroupVersion
// AddToScheme is DEPRECATED
AddToScheme = Install
)
// addKnownTypes adds types to API group
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(GroupVersion,
&MCOConfig{},
&ContainerRuntimeConfig{},
&ContainerRuntimeConfigList{},
&ControllerConfig{},
&ControllerConfigList{},
&KubeletConfig{},
&KubeletConfigList{},
&MachineConfig{},
&MachineConfigList{},
&MachineConfigPool{},
&MachineConfigPoolList{},
)
metav1.AddToGroupVersion(scheme, GroupVersion)
return nil
}
// Resource is used to validate existence of a resource in this API group
func Resource(resource string) schema.GroupResource {
return schema.GroupResource{Group: GroupName, Resource: resource}
}
// Kind is used to validate existence of a resource kind in this API group
func Kind(kind string) schema.GroupKind {
return schema.GroupKind{Group: GroupName, Kind: kind}
}