Switch to use TypedLocalObjectReference in core API

This commit is contained in:
Xing Yang
2018-08-30 06:23:03 -07:00
parent d50a9a9a66
commit c422fbde7c
6 changed files with 31 additions and 45 deletions

View File

@@ -71,7 +71,7 @@ type VolumeSnapshotSpec struct {
// In Alpha version, only PersistentVolumeClaim is supported as the source.
// If not specified, user can create VolumeSnapshotContent and bind it with VolumeSnapshot manually.
// +optional
Source *TypedLocalObjectReference `json:"source" protobuf:"bytes,1,opt,name=source"`
Source *core_v1.TypedLocalObjectReference `json:"source" protobuf:"bytes,1,opt,name=source"`
// SnapshotContentName binds the VolumeSnapshot object with the VolumeSnapshotContent
// +optional
@@ -110,15 +110,6 @@ type VolumeSnapshotStatus struct {
Error *storage.VolumeError `json:"error,omitempty" protobuf:"bytes,4,opt,name=error,casttype=VolumeError"`
}
// TypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace.
// TODO: After TypedLocalObjectReference is merged into the in-tree core API, this will be replaced.
type TypedLocalObjectReference struct {
// Name of the referent.
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
// Kind of the referent.
Kind string `json:"kind,omitempty" protobuf:"bytes,2,opt,name=kind"`
}
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

View File

@@ -52,22 +52,6 @@ func (in *CSIVolumeSnapshotSource) DeepCopy() *CSIVolumeSnapshotSource {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TypedLocalObjectReference) DeepCopyInto(out *TypedLocalObjectReference) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypedLocalObjectReference.
func (in *TypedLocalObjectReference) DeepCopy() *TypedLocalObjectReference {
if in == nil {
return nil
}
out := new(TypedLocalObjectReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VolumeSnapshot) DeepCopyInto(out *VolumeSnapshot) {
*out = *in
@@ -313,8 +297,8 @@ func (in *VolumeSnapshotSpec) DeepCopyInto(out *VolumeSnapshotSpec) {
*out = *in
if in.Source != nil {
in, out := &in.Source, &out.Source
*out = new(TypedLocalObjectReference)
**out = **in
*out = new(v1.TypedLocalObjectReference)
(*in).DeepCopyInto(*out)
}
if in.VolumeSnapshotClassName != nil {
in, out := &in.VolumeSnapshotClassName, &out.VolumeSnapshotClassName