mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-04-12 00:00:26 +08:00
Merge pull request #54463 from saad-ali/volumeAttachmentAPI
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Introduce new `VolumeAttachment` API Object **What this PR does / why we need it**: Introduce a new `VolumeAttachment` API Object. This object will be used by the CSI volume plugin to enable external attachers (see design [here](https://github.com/kubernetes/community/pull/1258). In the future, existing volume plugins can be refactored to use this object as well. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: Part of issue https://github.com/kubernetes/features/issues/178 **Special notes for your reviewer**: None **Release note**: ```release-note NONE ``` Kubernetes-commit: ebe8ea73fd1a961779242dfbb629befa153e96fc
This commit is contained in:
+2
-2
@@ -94,8 +94,6 @@ type missingVersionErr struct {
|
||||
data string
|
||||
}
|
||||
|
||||
// IsMissingVersion returns true if the error indicates that the provided object
|
||||
// is missing a 'Version' field.
|
||||
func NewMissingVersionErr(data string) error {
|
||||
return &missingVersionErr{data}
|
||||
}
|
||||
@@ -104,6 +102,8 @@ func (k *missingVersionErr) Error() string {
|
||||
return fmt.Sprintf("Object 'apiVersion' is missing in '%s'", k.data)
|
||||
}
|
||||
|
||||
// IsMissingVersion returns true if the error indicates that the provided object
|
||||
// is missing a 'Version' field.
|
||||
func IsMissingVersion(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
|
||||
+4
-32
@@ -68,10 +68,6 @@ type Scheme struct {
|
||||
// converter stores all registered conversion functions. It also has
|
||||
// default coverting behavior.
|
||||
converter *conversion.Converter
|
||||
|
||||
// cloner stores all registered copy functions. It also has default
|
||||
// deep copy behavior.
|
||||
cloner *conversion.Cloner
|
||||
}
|
||||
|
||||
// Function to convert a field selector to internal representation.
|
||||
@@ -80,11 +76,10 @@ type FieldLabelConversionFunc func(label, value string) (internalLabel, internal
|
||||
// NewScheme creates a new Scheme. This scheme is pluggable by default.
|
||||
func NewScheme() *Scheme {
|
||||
s := &Scheme{
|
||||
gvkToType: map[schema.GroupVersionKind]reflect.Type{},
|
||||
typeToGVK: map[reflect.Type][]schema.GroupVersionKind{},
|
||||
unversionedTypes: map[reflect.Type]schema.GroupVersionKind{},
|
||||
unversionedKinds: map[string]reflect.Type{},
|
||||
cloner: conversion.NewCloner(),
|
||||
gvkToType: map[schema.GroupVersionKind]reflect.Type{},
|
||||
typeToGVK: map[reflect.Type][]schema.GroupVersionKind{},
|
||||
unversionedTypes: map[reflect.Type]schema.GroupVersionKind{},
|
||||
unversionedKinds: map[string]reflect.Type{},
|
||||
fieldLabelConversionFuncs: map[string]map[string]FieldLabelConversionFunc{},
|
||||
defaulterFuncs: map[reflect.Type]func(interface{}){},
|
||||
}
|
||||
@@ -354,29 +349,6 @@ func (s *Scheme) AddGeneratedConversionFuncs(conversionFuncs ...interface{}) err
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddDeepCopyFuncs adds a function to the list of deep-copy functions.
|
||||
// For the expected format of deep-copy function, see the comment for
|
||||
// Copier.RegisterDeepCopyFunction.
|
||||
func (s *Scheme) AddDeepCopyFuncs(deepCopyFuncs ...interface{}) error {
|
||||
for _, f := range deepCopyFuncs {
|
||||
if err := s.cloner.RegisterDeepCopyFunc(f); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Similar to AddDeepCopyFuncs, but registers deep-copy functions that were
|
||||
// automatically generated.
|
||||
func (s *Scheme) AddGeneratedDeepCopyFuncs(deepCopyFuncs ...conversion.GeneratedDeepCopyFunc) error {
|
||||
for _, fn := range deepCopyFuncs {
|
||||
if err := s.cloner.RegisterGeneratedDeepCopyFunc(fn); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddFieldLabelConversionFunc adds a conversion function to convert field selectors
|
||||
// of the given kind from the given version to internal version representation.
|
||||
func (s *Scheme) AddFieldLabelConversionFunc(version, kind string, conversionFunc FieldLabelConversionFunc) error {
|
||||
|
||||
-25
@@ -20,31 +20,6 @@ limitations under the License.
|
||||
|
||||
package runtime
|
||||
|
||||
import (
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
// GetGeneratedDeepCopyFuncs returns the generated funcs, since we aren't registering them.
|
||||
//
|
||||
// Deprecated: deepcopy registration will go away when static deepcopy is fully implemented.
|
||||
func GetGeneratedDeepCopyFuncs() []conversion.GeneratedDeepCopyFunc {
|
||||
return []conversion.GeneratedDeepCopyFunc{
|
||||
{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*RawExtension).DeepCopyInto(out.(*RawExtension))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&RawExtension{})},
|
||||
{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*Unknown).DeepCopyInto(out.(*Unknown))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&Unknown{})},
|
||||
{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*VersionedObjects).DeepCopyInto(out.(*VersionedObjects))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&VersionedObjects{})},
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RawExtension) DeepCopyInto(out *RawExtension) {
|
||||
*out = *in
|
||||
|
||||
Reference in New Issue
Block a user