-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
register.go
40 lines (33 loc) · 1.28 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
package v1
import (
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/openshift/origin/pkg/image/admission/imagepolicy/api"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: "", Version: "v1"}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addConversionFuncs, addDefaultingFuncs)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&ImagePolicyConfig{},
)
return nil
}
func addConversionFuncs(scheme *runtime.Scheme) error {
return scheme.AddConversionFuncs(
// TODO: remove when MatchSignatures is implemented
func(in *ImageCondition, out *api.ImageCondition, s conversion.Scope) error {
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields)
},
// TODO: remove when ConsumptionRules and PlacementRules are implemented
func(in *ImagePolicyConfig, out *api.ImagePolicyConfig, s conversion.Scope) error {
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields)
},
)
}
func (obj *ImagePolicyConfig) GetObjectKind() schema.ObjectKind { return &obj.TypeMeta }