e2e: update snapshot to v1beta1

updating the snapshot client and
test to use v1beta1 client and API.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit a17fef07e6)
This commit is contained in:
Madhu Rajanna
2024-12-12 13:31:29 +01:00
committed by mergify[bot]
parent bfcac1af5b
commit 7740476ba8
16 changed files with 202 additions and 192 deletions

View File

@ -17,4 +17,4 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +groupName=groupsnapshot.storage.k8s.io
package v1alpha1
package v1beta1

View File

@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -28,7 +28,7 @@ var (
// AddToScheme adds to scheme
AddToScheme = SchemeBuilder.AddToScheme
// SchemeGroupVersion is the group version used to register these objects.
SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
)
func Resource(resource string) schema.GroupResource {

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +kubebuilder:object:generate=true
package v1alpha1
package v1beta1
import (
core_v1 "k8s.io/api/core/v1"
@ -90,6 +90,7 @@ type VolumeGroupSnapshotStatus struct {
// The format of this field is a Unix nanoseconds time encoded as an int64.
// On Unix, the command date +%s%N returns the current time in nanoseconds
// since 1970-01-01 00:00:00 UTC.
// This field is updated based on the CreationTime field in VolumeGroupSnapshotContentStatus
// +optional
CreationTime *metav1.Time `json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"`
@ -108,21 +109,6 @@ type VolumeGroupSnapshotStatus struct {
// group snapshot creation. Upon success, this error field will be cleared.
// +optional
Error *snapshotv1.VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,4,opt,name=error,casttype=VolumeSnapshotError"`
// VolumeSnapshotRefList is the list of PVC and VolumeSnapshot pairs that
// is part of this group snapshot.
// The maximum number of allowed snapshots in the group is 100.
// +optional
PVCVolumeSnapshotRefList []PVCVolumeSnapshotPair `json:"pvcVolumeSnapshotRefList,omitempty" protobuf:"bytes,5,opt,name=pvcVolumeSnapshotRefList"`
}
// PVCVolumeSnapshotPair defines a pair of a PVC reference and a Volume Snapshot Reference
type PVCVolumeSnapshotPair struct {
// PersistentVolumeClaimRef is a reference to the PVC this pair is referring to
PersistentVolumeClaimRef core_v1.LocalObjectReference `json:"persistentVolumeClaimRef,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeClaimRef"`
// VolumeSnapshotRef is a reference to the VolumeSnapshot this pair is referring to
VolumeSnapshotRef core_v1.LocalObjectReference `json:"volumeSnapshotRef,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotRef"`
}
//+genclient
@ -281,7 +267,6 @@ type VolumeGroupSnapshotContentSpec struct {
// This field is immutable after creation.
// Required.
// +kubebuilder:validation:XValidation:rule="has(self.name) && has(self.__namespace__)",message="both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set"
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupSnapshotRef is immutable"
VolumeGroupSnapshotRef core_v1.ObjectReference `json:"volumeGroupSnapshotRef" protobuf:"bytes,1,opt,name=volumeGroupSnapshotRef"`
// DeletionPolicy determines whether this VolumeGroupSnapshotContent and the
@ -340,8 +325,9 @@ type VolumeGroupSnapshotContentStatus struct {
// The format of this field is a Unix nanoseconds time encoded as an int64.
// On Unix, the command date +%s%N returns the current time in nanoseconds
// since 1970-01-01 00:00:00 UTC.
// This field is the source for the CreationTime field in VolumeGroupSnapshotStatus
// +optional
CreationTime *int64 `json:"creationTime,omitempty" protobuf:"varint,2,opt,name=creationTime"`
CreationTime *metav1.Time `json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"`
// ReadyToUse indicates if all the individual snapshots in the group are ready to be
// used to restore a group of volumes.
@ -354,21 +340,11 @@ type VolumeGroupSnapshotContentStatus struct {
// +optional
Error *snapshotv1.VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,4,opt,name=error,casttype=VolumeSnapshotError"`
// PVVolumeSnapshotContentList is the list of pairs of PV and
// VolumeSnapshotContent for this group snapshot
// The maximum number of allowed snapshots in the group is 100.
// VolumeSnapshotHandlePairList is a list of CSI "volume_id" and "snapshot_id"
// pair returned by the CSI driver to identify snapshots and their source volumes
// on the storage system.
// +optional
PVVolumeSnapshotContentList []PVVolumeSnapshotContentPair `json:"pvVolumeSnapshotContentList,omitempty" protobuf:"bytes,5,opt,name=pvVolumeSnapshotContentRefList"`
}
// PVVolumeSnapshotContentPair represent a pair of PV names and
// VolumeSnapshotContent names
type PVVolumeSnapshotContentPair struct {
// PersistentVolumeRef is a reference to the persistent volume resource
PersistentVolumeRef core_v1.LocalObjectReference `json:"persistentVolumeRef,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeRef"`
// VolumeSnapshotContentRef is a reference to the volume snapshot content resource
VolumeSnapshotContentRef core_v1.LocalObjectReference `json:"volumeSnapshotContentRef,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotContentRef"`
VolumeSnapshotHandlePairList []VolumeSnapshotHandlePair `json:"volumeSnapshotHandlePairList,omitempty" protobuf:"bytes,6,opt,name=volumeSnapshotHandlePairList"`
}
// VolumeGroupSnapshotContentSource represents the CSI source of a group snapshot.
@ -410,3 +386,16 @@ type GroupSnapshotHandles struct {
// Required.
VolumeSnapshotHandles []string `json:"volumeSnapshotHandles" protobuf:"bytes,2,opt,name=volumeSnapshotHandles"`
}
// VolumeSnapshotHandlePair defines a pair of a source volume handle and a snapshot handle
type VolumeSnapshotHandlePair struct {
// VolumeHandle is a unique id returned by the CSI driver to identify a volume
// on the storage system
// Required.
VolumeHandle string `json:"volumeHandle" protobuf:"bytes,1,opt,name=volumeHandle"`
// SnapshotHandle is a unique id returned by the CSI driver to identify a volume
// snapshot on the storage system
// Required.
SnapshotHandle string `json:"snapshotHandle" protobuf:"bytes,2,opt,name=snapshotHandle"`
}

View File

@ -19,7 +19,7 @@ limitations under the License.
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1alpha1
package v1beta1
import (
v1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1"
@ -48,42 +48,6 @@ func (in *GroupSnapshotHandles) DeepCopy() *GroupSnapshotHandles {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PVCVolumeSnapshotPair) DeepCopyInto(out *PVCVolumeSnapshotPair) {
*out = *in
out.PersistentVolumeClaimRef = in.PersistentVolumeClaimRef
out.VolumeSnapshotRef = in.VolumeSnapshotRef
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PVCVolumeSnapshotPair.
func (in *PVCVolumeSnapshotPair) DeepCopy() *PVCVolumeSnapshotPair {
if in == nil {
return nil
}
out := new(PVCVolumeSnapshotPair)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PVVolumeSnapshotContentPair) DeepCopyInto(out *PVVolumeSnapshotContentPair) {
*out = *in
out.PersistentVolumeRef = in.PersistentVolumeRef
out.VolumeSnapshotContentRef = in.VolumeSnapshotContentRef
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PVVolumeSnapshotContentPair.
func (in *PVVolumeSnapshotContentPair) DeepCopy() *PVVolumeSnapshotContentPair {
if in == nil {
return nil
}
out := new(PVVolumeSnapshotContentPair)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VolumeGroupSnapshot) DeepCopyInto(out *VolumeGroupSnapshot) {
*out = *in
@ -306,8 +270,7 @@ func (in *VolumeGroupSnapshotContentStatus) DeepCopyInto(out *VolumeGroupSnapsho
}
if in.CreationTime != nil {
in, out := &in.CreationTime, &out.CreationTime
*out = new(int64)
**out = **in
*out = (*in).DeepCopy()
}
if in.ReadyToUse != nil {
in, out := &in.ReadyToUse, &out.ReadyToUse
@ -319,9 +282,9 @@ func (in *VolumeGroupSnapshotContentStatus) DeepCopyInto(out *VolumeGroupSnapsho
*out = new(v1.VolumeSnapshotError)
(*in).DeepCopyInto(*out)
}
if in.PVVolumeSnapshotContentList != nil {
in, out := &in.PVVolumeSnapshotContentList, &out.PVVolumeSnapshotContentList
*out = make([]PVVolumeSnapshotContentPair, len(*in))
if in.VolumeSnapshotHandlePairList != nil {
in, out := &in.VolumeSnapshotHandlePairList, &out.VolumeSnapshotHandlePairList
*out = make([]VolumeSnapshotHandlePair, len(*in))
copy(*out, *in)
}
return
@ -440,11 +403,6 @@ func (in *VolumeGroupSnapshotStatus) DeepCopyInto(out *VolumeGroupSnapshotStatus
*out = new(v1.VolumeSnapshotError)
(*in).DeepCopyInto(*out)
}
if in.PVCVolumeSnapshotRefList != nil {
in, out := &in.PVCVolumeSnapshotRefList, &out.PVCVolumeSnapshotRefList
*out = make([]PVCVolumeSnapshotPair, len(*in))
copy(*out, *in)
}
return
}
@ -457,3 +415,19 @@ func (in *VolumeGroupSnapshotStatus) DeepCopy() *VolumeGroupSnapshotStatus {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VolumeSnapshotHandlePair) DeepCopyInto(out *VolumeSnapshotHandlePair) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotHandlePair.
func (in *VolumeSnapshotHandlePair) DeepCopy() *VolumeSnapshotHandlePair {
if in == nil {
return nil
}
out := new(VolumeSnapshotHandlePair)
in.DeepCopyInto(out)
return out
}