-
Notifications
You must be signed in to change notification settings - Fork 729
/
register.go
44 lines (35 loc) · 1.4 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
// Package v1alpha1 contains API Schema definitions for the sources v1alpha1 API group
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen=package,register
// +k8s:defaulter-gen=TypeMeta
// +groupName=argoproj.io
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/argoproj/argo-events/pkg/apis/eventbus"
)
var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: eventbus.Group, Version: "v1alpha1"}
// SchemaGroupVersionKind is a group version kind used to attach owner references
SchemaGroupVersionKind = SchemeGroupVersion.WithKind(eventbus.Kind)
SchemaGroupVersionResource = SchemeGroupVersion.WithResource(eventbus.Plural)
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// AddToScheme is required by pkg/client/...
AddToScheme = SchemeBuilder.AddToScheme
)
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&EventBus{},
&EventBusList{},
)
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}