67
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go
generated
vendored
67
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go
generated
vendored
@ -25,6 +25,13 @@ import (
|
||||
// GroupName is the group name for this API.
|
||||
const GroupName = "meta.k8s.io"
|
||||
|
||||
var (
|
||||
// localSchemeBuilder is used to make compiler happy for autogenerated
|
||||
// conversions. However, it's not used.
|
||||
schemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &schemeBuilder
|
||||
)
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
|
||||
|
||||
@ -40,6 +47,22 @@ func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// scheme is the registry for the common types that adhere to the meta v1 API spec.
|
||||
var scheme = runtime.NewScheme()
|
||||
|
||||
// ParameterCodec knows about query parameters used with the meta v1 API spec.
|
||||
var ParameterCodec = runtime.NewParameterCodec(scheme)
|
||||
|
||||
var optionsTypes = []runtime.Object{
|
||||
&ListOptions{},
|
||||
&ExportOptions{},
|
||||
&GetOptions{},
|
||||
&DeleteOptions{},
|
||||
&CreateOptions{},
|
||||
&UpdateOptions{},
|
||||
&PatchOptions{},
|
||||
}
|
||||
|
||||
// AddToGroupVersion registers common meta types into schemas.
|
||||
func AddToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion) {
|
||||
scheme.AddKnownTypeWithName(groupVersion.WithKind(WatchEventKind), &WatchEvent{})
|
||||
@ -48,21 +71,7 @@ func AddToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion)
|
||||
&InternalEvent{},
|
||||
)
|
||||
// Supports legacy code paths, most callers should use metav1.ParameterCodec for now
|
||||
scheme.AddKnownTypes(groupVersion,
|
||||
&ListOptions{},
|
||||
&ExportOptions{},
|
||||
&GetOptions{},
|
||||
&DeleteOptions{},
|
||||
&CreateOptions{},
|
||||
&UpdateOptions{},
|
||||
&PatchOptions{},
|
||||
)
|
||||
utilruntime.Must(scheme.AddConversionFuncs(
|
||||
Convert_v1_WatchEvent_To_watch_Event,
|
||||
Convert_v1_InternalEvent_To_v1_WatchEvent,
|
||||
Convert_watch_Event_To_v1_WatchEvent,
|
||||
Convert_v1_WatchEvent_To_v1_InternalEvent,
|
||||
))
|
||||
scheme.AddKnownTypes(groupVersion, optionsTypes...)
|
||||
// Register Unversioned types under their own special group
|
||||
scheme.AddUnversionedTypes(Unversioned,
|
||||
&Status{},
|
||||
@ -73,26 +82,26 @@ func AddToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion)
|
||||
)
|
||||
|
||||
// register manually. This usually goes through the SchemeBuilder, which we cannot use here.
|
||||
utilruntime.Must(AddConversionFuncs(scheme))
|
||||
utilruntime.Must(RegisterConversions(scheme))
|
||||
utilruntime.Must(RegisterDefaults(scheme))
|
||||
}
|
||||
|
||||
// scheme is the registry for the common types that adhere to the meta v1 API spec.
|
||||
var scheme = runtime.NewScheme()
|
||||
// AddMetaToScheme registers base meta types into schemas.
|
||||
func AddMetaToScheme(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&Table{},
|
||||
&TableOptions{},
|
||||
&PartialObjectMetadata{},
|
||||
&PartialObjectMetadataList{},
|
||||
)
|
||||
|
||||
// ParameterCodec knows about query parameters used with the meta v1 API spec.
|
||||
var ParameterCodec = runtime.NewParameterCodec(scheme)
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
scheme.AddUnversionedTypes(SchemeGroupVersion,
|
||||
&ListOptions{},
|
||||
&ExportOptions{},
|
||||
&GetOptions{},
|
||||
&DeleteOptions{},
|
||||
&CreateOptions{},
|
||||
&UpdateOptions{},
|
||||
&PatchOptions{},
|
||||
)
|
||||
scheme.AddUnversionedTypes(SchemeGroupVersion, optionsTypes...)
|
||||
|
||||
utilruntime.Must(AddMetaToScheme(scheme))
|
||||
|
||||
// register manually. This usually goes through the SchemeBuilder, which we cannot use here.
|
||||
utilruntime.Must(RegisterDefaults(scheme))
|
||||
|
Reference in New Issue
Block a user