-
Notifications
You must be signed in to change notification settings - Fork 74
/
register.go
43 lines (34 loc) · 1.53 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
// NOTE: Boilerplate only. Ignore this file.
// Package v1alpha1 contains API Schema definitions for the localstorage v1alpha1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=hwameistor.io
package v1alpha1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
// AddToSchemes may be used to add all resources defined in the project to a Scheme for Local Storage Member
var AddToSchemes runtime.SchemeBuilder
// AddToScheme adds all Resources to the Scheme for Local Storage Member
func AddToScheme(s *runtime.Scheme) error {
return AddToSchemes.AddToScheme(s)
}
var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "hwameistor.io", Version: "v1alpha1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme for Local Storage Member
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
)
func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes, SchemeBuilder.AddToScheme)
}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}