From a568322aa18ca8691ce7f7104d51f13be574329d Mon Sep 17 00:00:00 2001 From: Raunak Pradip Shah Date: Tue, 10 May 2022 16:11:21 +0530 Subject: [PATCH 1/4] Remove v1beta1 APIs and generated functions --- client/apis/volumesnapshot/v1beta1/doc.go | 20 - .../apis/volumesnapshot/v1beta1/register.go | 58 --- client/apis/volumesnapshot/v1beta1/types.go | 395 ---------------- .../v1beta1/zz_generated.deepcopy.go | 425 ------------------ client/clientset/versioned/clientset.go | 15 +- .../versioned/fake/clientset_generated.go | 7 - client/clientset/versioned/fake/register.go | 2 - client/clientset/versioned/scheme/register.go | 2 - .../typed/volumesnapshot/v1beta1/doc.go | 20 - .../typed/volumesnapshot/v1beta1/fake/doc.go | 20 - .../v1beta1/fake/fake_volumesnapshot.go | 142 ------ .../fake/fake_volumesnapshot_client.go | 48 -- .../v1beta1/fake/fake_volumesnapshotclass.go | 122 ----- .../fake/fake_volumesnapshotcontent.go | 133 ------ .../v1beta1/generated_expansion.go | 25 -- .../volumesnapshot/v1beta1/volumesnapshot.go | 195 -------- .../v1beta1/volumesnapshot_client.go | 117 ----- .../v1beta1/volumesnapshotclass.go | 168 ------- .../v1beta1/volumesnapshotcontent.go | 184 -------- ....storage.k8s.io_volumesnapshotclasses.yaml | 51 +-- ...storage.k8s.io_volumesnapshotcontents.yaml | 256 ++++------- ...apshot.storage.k8s.io_volumesnapshots.yaml | 108 +---- client/hack/README.md | 68 --- client/hack/update-generated-code.sh | 3 +- client/informers/externalversions/generic.go | 9 - .../volumesnapshot/interface.go | 8 - .../volumesnapshot/v1beta1/interface.go | 59 --- .../volumesnapshot/v1beta1/volumesnapshot.go | 90 ---- .../v1beta1/volumesnapshotclass.go | 89 ---- .../v1beta1/volumesnapshotcontent.go | 89 ---- .../v1beta1/expansion_generated.go | 35 -- .../volumesnapshot/v1beta1/volumesnapshot.go | 99 ---- .../v1beta1/volumesnapshotclass.go | 68 --- .../v1beta1/volumesnapshotcontent.go | 68 --- 34 files changed, 99 insertions(+), 3099 deletions(-) delete mode 100644 client/apis/volumesnapshot/v1beta1/doc.go delete mode 100644 client/apis/volumesnapshot/v1beta1/register.go delete mode 100644 client/apis/volumesnapshot/v1beta1/types.go delete mode 100644 client/apis/volumesnapshot/v1beta1/zz_generated.deepcopy.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/doc.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/doc.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot_client.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotclass.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotcontent.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/generated_expansion.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot_client.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotclass.go delete mode 100644 client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotcontent.go delete mode 100644 client/informers/externalversions/volumesnapshot/v1beta1/interface.go delete mode 100644 client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshot.go delete mode 100644 client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotclass.go delete mode 100644 client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotcontent.go delete mode 100644 client/listers/volumesnapshot/v1beta1/expansion_generated.go delete mode 100644 client/listers/volumesnapshot/v1beta1/volumesnapshot.go delete mode 100644 client/listers/volumesnapshot/v1beta1/volumesnapshotclass.go delete mode 100644 client/listers/volumesnapshot/v1beta1/volumesnapshotcontent.go diff --git a/client/apis/volumesnapshot/v1beta1/doc.go b/client/apis/volumesnapshot/v1beta1/doc.go deleted file mode 100644 index d8a1f5dad..000000000 --- a/client/apis/volumesnapshot/v1beta1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// +k8s:deepcopy-gen=package -// +groupName=snapshot.storage.k8s.io - -package v1beta1 diff --git a/client/apis/volumesnapshot/v1beta1/register.go b/client/apis/volumesnapshot/v1beta1/register.go deleted file mode 100644 index 91f451424..000000000 --- a/client/apis/volumesnapshot/v1beta1/register.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name use in this package. -const GroupName = "snapshot.storage.k8s.io" - -var ( - // SchemeBuilder is the new scheme builder - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - // AddToScheme adds to scheme - AddToScheme = SchemeBuilder.AddToScheme - // SchemeGroupVersion is the group version used to register these objects. - SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} -) - -// Resource takes an unqualified resource and returns a Group-qualified GroupResource. -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -func init() { - // We only register manually written functions here. The registration of the - // generated functions takes place in the generated files. The separation - // makes the code compile even when the generated files are missing. - SchemeBuilder.Register(addKnownTypes) -} - -// addKnownTypes adds the set of types defined in this package to the supplied scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &VolumeSnapshotClass{}, - &VolumeSnapshotClassList{}, - &VolumeSnapshot{}, - &VolumeSnapshotList{}, - &VolumeSnapshotContent{}, - &VolumeSnapshotContentList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/client/apis/volumesnapshot/v1beta1/types.go b/client/apis/volumesnapshot/v1beta1/types.go deleted file mode 100644 index 0c672c11a..000000000 --- a/client/apis/volumesnapshot/v1beta1/types.go +++ /dev/null @@ -1,395 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// +kubebuilder:object:generate=true -package v1beta1 - -import ( - core_v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VolumeSnapshot is a user's request for either creating a point-in-time -// snapshot of a persistent volume, or binding to a pre-existing snapshot. -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Namespaced,shortName=vs -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="ReadyToUse",type=boolean,JSONPath=`.status.readyToUse`,description="Indicates if a snapshot is ready to be used to restore a volume." -// +kubebuilder:printcolumn:name="SourcePVC",type=string,JSONPath=`.spec.source.persistentVolumeClaimName`,description="Name of the source PVC from where a dynamically taken snapshot will be created." -// +kubebuilder:printcolumn:name="SourceSnapshotContent",type=string,JSONPath=`.spec.source.volumeSnapshotContentName`,description="Name of the VolumeSnapshotContent which represents a pre-provisioned snapshot." -// +kubebuilder:printcolumn:name="RestoreSize",type=string,JSONPath=`.status.restoreSize`,description="Represents the complete size of the snapshot." -// +kubebuilder:printcolumn:name="SnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="The name of the VolumeSnapshotClass requested by the VolumeSnapshot." -// +kubebuilder:printcolumn:name="SnapshotContent",type=string,JSONPath=`.status.boundVolumeSnapshotContentName`,description="The name of the VolumeSnapshotContent to which this VolumeSnapshot is bound." -// +kubebuilder:printcolumn:name="CreationTime",type=date,JSONPath=`.status.creationTime`,description="Timestamp when the point-in-time snapshot is taken by the underlying storage system." -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` -type VolumeSnapshot struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // spec defines the desired characteristics of a snapshot requested by a user. - // More info: https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots - // Required. - Spec VolumeSnapshotSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - - // status represents the current information of a snapshot. - // NOTE: status can be modified by sources other than system controllers, - // and must not be depended upon for accuracy. - // Controllers should only use information from the VolumeSnapshotContent object - // after verifying that the binding is accurate and complete. - // +optional - Status *VolumeSnapshotStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// VolumeSnapshotList is a list of VolumeSnapshot objects -type VolumeSnapshotList struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // List of VolumeSnapshots - Items []VolumeSnapshot `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// VolumeSnapshotSpec describes the common attributes of a volume snapshot. -type VolumeSnapshotSpec struct { - // source specifies where a snapshot will be created from. - // This field is immutable after creation. - // Required. - Source VolumeSnapshotSource `json:"source" protobuf:"bytes,1,opt,name=source"` - - // volumeSnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot. - // If not specified, the default snapshot class will be used if one exists. - // If not specified, and there is no default snapshot class, dynamic snapshot creation will fail. - // Empty string is not allowed for this field. - // TODO(xiangqian): a webhook validation on empty string. - // More info: https://kubernetes.io/docs/concepts/storage/volume-snapshot-classes - // +optional - VolumeSnapshotClassName *string `json:"volumeSnapshotClassName,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotClassName"` -} - -// VolumeSnapshotSource specifies whether the underlying snapshot should be -// dynamically taken upon creation or if a pre-existing VolumeSnapshotContent -// object should be used. -// Exactly one of its members must be set. -// Members in VolumeSnapshotSource are immutable. -// TODO(xiangqian): Add a webhook to ensure that VolumeSnapshotSource members -// will not be updated once specified. -type VolumeSnapshotSource struct { - // persistentVolumeClaimName specifies the name of the PersistentVolumeClaim - // object in the same namespace as the VolumeSnapshot object where the - // snapshot should be dynamically taken from. - // This field is immutable. - // +optional - PersistentVolumeClaimName *string `json:"persistentVolumeClaimName,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeClaimName"` - - // volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent - // object. - // This field is immutable. - // +optional - VolumeSnapshotContentName *string `json:"volumeSnapshotContentName,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotContentName"` -} - -// VolumeSnapshotStatus is the status of the VolumeSnapshot -type VolumeSnapshotStatus struct { - // boundVolumeSnapshotContentName represents the name of the VolumeSnapshotContent - // object to which the VolumeSnapshot object is bound. - // If not specified, it indicates that the VolumeSnapshot object has not been - // successfully bound to a VolumeSnapshotContent object yet. - // NOTE: Specified boundVolumeSnapshotContentName alone does not mean binding - // is valid. Controllers MUST always verify bidirectional binding between - // VolumeSnapshot and VolumeSnapshotContent to avoid possible security issues. - // +optional - BoundVolumeSnapshotContentName *string `json:"boundVolumeSnapshotContentName,omitempty" protobuf:"bytes,1,opt,name=boundVolumeSnapshotContentName"` - - // creationTime is the timestamp when the point-in-time snapshot is taken - // by the underlying storage system. - // In dynamic snapshot creation case, this field will be filled in with the - // "creation_time" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "creation_time" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - // If not specified, it indicates that the creation time of the snapshot is unknown. - // +optional - CreationTime *metav1.Time `json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"` - - // readyToUse indicates if a snapshot is ready to be used to restore a volume. - // In dynamic snapshot creation case, this field will be filled in with the - // "ready_to_use" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "ready_to_use" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, - // otherwise, this field will be set to "True". - // If not specified, it means the readiness of a snapshot is unknown. - // +optional - ReadyToUse *bool `json:"readyToUse,omitempty" protobuf:"varint,3,opt,name=readyToUse"` - - // restoreSize represents the complete size of the snapshot in bytes. - // In dynamic snapshot creation case, this field will be filled in with the - // "size_bytes" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "size_bytes" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - // When restoring a volume from this snapshot, the size of the volume MUST NOT - // be smaller than the restoreSize if it is specified, otherwise the restoration will fail. - // If not specified, it indicates that the size is unknown. - // +optional - RestoreSize *resource.Quantity `json:"restoreSize,omitempty" protobuf:"bytes,4,opt,name=restoreSize"` - - // error is the last observed error during snapshot creation, if any. - // This field could be helpful to upper level controllers(i.e., application controller) - // to decide whether they should continue on waiting for the snapshot to be created - // based on the type of error reported. - // +optional - Error *VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,5,opt,name=error,casttype=VolumeSnapshotError"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VolumeSnapshotClass specifies parameters that a underlying storage system uses when -// creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its -// name in a VolumeSnapshot object. -// VolumeSnapshotClasses are non-namespaced -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=vsclass;vsclasses -// +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.driver` -// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.deletionPolicy`,description="Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted." -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` -type VolumeSnapshotClass struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // driver is the name of the storage driver that handles this VolumeSnapshotClass. - // Required. - Driver string `json:"driver" protobuf:"bytes,2,opt,name=driver"` - - // parameters is a key-value map with storage driver specific parameters for creating snapshots. - // These values are opaque to Kubernetes. - // +optional - Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"` - - // deletionPolicy determines whether a VolumeSnapshotContent created through - // the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. - // Supported values are "Retain" and "Delete". - // "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. - // "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. - // Required. - DeletionPolicy DeletionPolicy `json:"deletionPolicy" protobuf:"bytes,4,opt,name=deletionPolicy"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VolumeSnapshotClassList is a collection of VolumeSnapshotClasses. -// +kubebuilder:object:root=true -type VolumeSnapshotClassList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of VolumeSnapshotClasses - Items []VolumeSnapshotClass `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VolumeSnapshotContent represents the actual "on-disk" snapshot object in the -// underlying storage system -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=vsc;vscs -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="ReadyToUse",type=boolean,JSONPath=`.status.readyToUse`,description="Indicates if a snapshot is ready to be used to restore a volume." -// +kubebuilder:printcolumn:name="RestoreSize",type=integer,JSONPath=`.status.restoreSize`,description="Represents the complete size of the snapshot in bytes" -// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.spec.deletionPolicy`,description="Determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted." -// +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.spec.driver`,description="Name of the CSI driver used to create the physical snapshot on the underlying storage system." -// +kubebuilder:printcolumn:name="VolumeSnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="Name of the VolumeSnapshotClass to which this snapshot belongs." -// +kubebuilder:printcolumn:name="VolumeSnapshot",type=string,JSONPath=`.spec.volumeSnapshotRef.name`,description="Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound." -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` -type VolumeSnapshotContent struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // spec defines properties of a VolumeSnapshotContent created by the underlying storage system. - // Required. - Spec VolumeSnapshotContentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - - // status represents the current information of a snapshot. - // +optional - Status *VolumeSnapshotContentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VolumeSnapshotContentList is a list of VolumeSnapshotContent objects -// +kubebuilder:object:root=true -type VolumeSnapshotContentList struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of VolumeSnapshotContents - Items []VolumeSnapshotContent `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// VolumeSnapshotContentSpec is the specification of a VolumeSnapshotContent -type VolumeSnapshotContentSpec struct { - // volumeSnapshotRef specifies the VolumeSnapshot object to which this - // VolumeSnapshotContent object is bound. - // VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to - // this VolumeSnapshotContent's name for the bidirectional binding to be valid. - // For a pre-existing VolumeSnapshotContent object, name and namespace of the - // VolumeSnapshot object MUST be provided for binding to happen. - // This field is immutable after creation. - // Required. - VolumeSnapshotRef core_v1.ObjectReference `json:"volumeSnapshotRef" protobuf:"bytes,1,opt,name=volumeSnapshotRef"` - - // deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on - // the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. - // Supported values are "Retain" and "Delete". - // "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. - // "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. - // In dynamic snapshot creation case, this field will be filled in with the "DeletionPolicy" field defined in the - // VolumeSnapshotClass the VolumeSnapshot refers to. - // For pre-existing snapshots, users MUST specify this field when creating the VolumeSnapshotContent object. - // Required. - DeletionPolicy DeletionPolicy `json:"deletionPolicy" protobuf:"bytes,2,opt,name=deletionPolicy"` - - // driver is the name of the CSI driver used to create the physical snapshot on - // the underlying storage system. - // This MUST be the same as the name returned by the CSI GetPluginName() call for - // that driver. - // Required. - Driver string `json:"driver" protobuf:"bytes,3,opt,name=driver"` - - // name of the VolumeSnapshotClass to which this snapshot belongs. - // +optional - VolumeSnapshotClassName *string `json:"volumeSnapshotClassName,omitempty" protobuf:"bytes,4,opt,name=volumeSnapshotClassName"` - - // source specifies from where a snapshot will be created. - // This field is immutable after creation. - // Required. - Source VolumeSnapshotContentSource `json:"source" protobuf:"bytes,5,opt,name=source"` -} - -// VolumeSnapshotContentSource represents the CSI source of a snapshot. -// Exactly one of its members must be set. -// Members in VolumeSnapshotContentSource are immutable. -// TODO(xiangqian): Add a webhook to ensure that VolumeSnapshotContentSource members -// will be immutable once specified. -type VolumeSnapshotContentSource struct { - // volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot - // should be dynamically taken from. - // This field is immutable. - // +optional - VolumeHandle *string `json:"volumeHandle,omitempty" protobuf:"bytes,1,opt,name=volumeHandle"` - - // snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on - // the underlying storage system. - // This field is immutable. - // +optional - SnapshotHandle *string `json:"snapshotHandle,omitempty" protobuf:"bytes,2,opt,name=snapshotHandle"` -} - -// VolumeSnapshotContentStatus is the status of a VolumeSnapshotContent object -type VolumeSnapshotContentStatus struct { - // snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system. - // If not specified, it indicates that dynamic snapshot creation has either failed - // or it is still in progress. - // +optional - SnapshotHandle *string `json:"snapshotHandle,omitempty" protobuf:"bytes,1,opt,name=snapshotHandle"` - - // creationTime is the timestamp when the point-in-time snapshot is taken - // by the underlying storage system. - // In dynamic snapshot creation case, this field will be filled in with the - // "creation_time" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "creation_time" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - // If not specified, it indicates the creation time is unknown. - // 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. - // +optional - CreationTime *int64 `json:"creationTime,omitempty" protobuf:"varint,2,opt,name=creationTime"` - - // restoreSize represents the complete size of the snapshot in bytes. - // In dynamic snapshot creation case, this field will be filled in with the - // "size_bytes" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "size_bytes" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - // When restoring a volume from this snapshot, the size of the volume MUST NOT - // be smaller than the restoreSize if it is specified, otherwise the restoration will fail. - // If not specified, it indicates that the size is unknown. - // +kubebuilder:validation:Minimum=0 - // +optional - RestoreSize *int64 `json:"restoreSize,omitempty" protobuf:"bytes,3,opt,name=restoreSize"` - - // readyToUse indicates if a snapshot is ready to be used to restore a volume. - // In dynamic snapshot creation case, this field will be filled in with the - // "ready_to_use" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "ready_to_use" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, - // otherwise, this field will be set to "True". - // If not specified, it means the readiness of a snapshot is unknown. - // +optional. - ReadyToUse *bool `json:"readyToUse,omitempty" protobuf:"varint,4,opt,name=readyToUse"` - - // error is the latest observed error during snapshot creation, if any. - // +optional - Error *VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,5,opt,name=error,casttype=VolumeSnapshotError"` -} - -// DeletionPolicy describes a policy for end-of-life maintenance of volume snapshot contents -// +kubebuilder:validation:Enum=Delete;Retain -type DeletionPolicy string - -const ( - // volumeSnapshotContentDelete means the snapshot will be deleted from the - // underlying storage system on release from its volume snapshot. - VolumeSnapshotContentDelete DeletionPolicy = "Delete" - - // volumeSnapshotContentRetain means the snapshot will be left in its current - // state on release from its volume snapshot. - VolumeSnapshotContentRetain DeletionPolicy = "Retain" -) - -// VolumeSnapshotError describes an error encountered during snapshot creation. -type VolumeSnapshotError struct { - // time is the timestamp when the error was encountered. - // +optional - Time *metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"` - - // message is a string detailing the encountered error during snapshot - // creation if specified. - // NOTE: message may be logged, and it should not contain sensitive - // information. - // +optional - Message *string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"` -} diff --git a/client/apis/volumesnapshot/v1beta1/zz_generated.deepcopy.go b/client/apis/volumesnapshot/v1beta1/zz_generated.deepcopy.go deleted file mode 100644 index 5a0c66828..000000000 --- a/client/apis/volumesnapshot/v1beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,425 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1beta1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// 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 - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(VolumeSnapshotStatus) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshot. -func (in *VolumeSnapshot) DeepCopy() *VolumeSnapshot { - if in == nil { - return nil - } - out := new(VolumeSnapshot) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshot) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotClass) DeepCopyInto(out *VolumeSnapshotClass) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Parameters != nil { - in, out := &in.Parameters, &out.Parameters - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotClass. -func (in *VolumeSnapshotClass) DeepCopy() *VolumeSnapshotClass { - if in == nil { - return nil - } - out := new(VolumeSnapshotClass) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshotClass) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotClassList) DeepCopyInto(out *VolumeSnapshotClassList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VolumeSnapshotClass, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotClassList. -func (in *VolumeSnapshotClassList) DeepCopy() *VolumeSnapshotClassList { - if in == nil { - return nil - } - out := new(VolumeSnapshotClassList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshotClassList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotContent) DeepCopyInto(out *VolumeSnapshotContent) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(VolumeSnapshotContentStatus) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContent. -func (in *VolumeSnapshotContent) DeepCopy() *VolumeSnapshotContent { - if in == nil { - return nil - } - out := new(VolumeSnapshotContent) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshotContent) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotContentList) DeepCopyInto(out *VolumeSnapshotContentList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VolumeSnapshotContent, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentList. -func (in *VolumeSnapshotContentList) DeepCopy() *VolumeSnapshotContentList { - if in == nil { - return nil - } - out := new(VolumeSnapshotContentList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshotContentList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotContentSource) DeepCopyInto(out *VolumeSnapshotContentSource) { - *out = *in - if in.VolumeHandle != nil { - in, out := &in.VolumeHandle, &out.VolumeHandle - *out = new(string) - **out = **in - } - if in.SnapshotHandle != nil { - in, out := &in.SnapshotHandle, &out.SnapshotHandle - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentSource. -func (in *VolumeSnapshotContentSource) DeepCopy() *VolumeSnapshotContentSource { - if in == nil { - return nil - } - out := new(VolumeSnapshotContentSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotContentSpec) DeepCopyInto(out *VolumeSnapshotContentSpec) { - *out = *in - out.VolumeSnapshotRef = in.VolumeSnapshotRef - if in.VolumeSnapshotClassName != nil { - in, out := &in.VolumeSnapshotClassName, &out.VolumeSnapshotClassName - *out = new(string) - **out = **in - } - in.Source.DeepCopyInto(&out.Source) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentSpec. -func (in *VolumeSnapshotContentSpec) DeepCopy() *VolumeSnapshotContentSpec { - if in == nil { - return nil - } - out := new(VolumeSnapshotContentSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotContentStatus) DeepCopyInto(out *VolumeSnapshotContentStatus) { - *out = *in - if in.SnapshotHandle != nil { - in, out := &in.SnapshotHandle, &out.SnapshotHandle - *out = new(string) - **out = **in - } - if in.CreationTime != nil { - in, out := &in.CreationTime, &out.CreationTime - *out = new(int64) - **out = **in - } - if in.RestoreSize != nil { - in, out := &in.RestoreSize, &out.RestoreSize - *out = new(int64) - **out = **in - } - if in.ReadyToUse != nil { - in, out := &in.ReadyToUse, &out.ReadyToUse - *out = new(bool) - **out = **in - } - if in.Error != nil { - in, out := &in.Error, &out.Error - *out = new(VolumeSnapshotError) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentStatus. -func (in *VolumeSnapshotContentStatus) DeepCopy() *VolumeSnapshotContentStatus { - if in == nil { - return nil - } - out := new(VolumeSnapshotContentStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotError) DeepCopyInto(out *VolumeSnapshotError) { - *out = *in - if in.Time != nil { - in, out := &in.Time, &out.Time - *out = (*in).DeepCopy() - } - if in.Message != nil { - in, out := &in.Message, &out.Message - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotError. -func (in *VolumeSnapshotError) DeepCopy() *VolumeSnapshotError { - if in == nil { - return nil - } - out := new(VolumeSnapshotError) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotList) DeepCopyInto(out *VolumeSnapshotList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VolumeSnapshot, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotList. -func (in *VolumeSnapshotList) DeepCopy() *VolumeSnapshotList { - if in == nil { - return nil - } - out := new(VolumeSnapshotList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshotList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotSource) DeepCopyInto(out *VolumeSnapshotSource) { - *out = *in - if in.PersistentVolumeClaimName != nil { - in, out := &in.PersistentVolumeClaimName, &out.PersistentVolumeClaimName - *out = new(string) - **out = **in - } - if in.VolumeSnapshotContentName != nil { - in, out := &in.VolumeSnapshotContentName, &out.VolumeSnapshotContentName - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotSource. -func (in *VolumeSnapshotSource) DeepCopy() *VolumeSnapshotSource { - if in == nil { - return nil - } - out := new(VolumeSnapshotSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotSpec) DeepCopyInto(out *VolumeSnapshotSpec) { - *out = *in - in.Source.DeepCopyInto(&out.Source) - if in.VolumeSnapshotClassName != nil { - in, out := &in.VolumeSnapshotClassName, &out.VolumeSnapshotClassName - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotSpec. -func (in *VolumeSnapshotSpec) DeepCopy() *VolumeSnapshotSpec { - if in == nil { - return nil - } - out := new(VolumeSnapshotSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotStatus) DeepCopyInto(out *VolumeSnapshotStatus) { - *out = *in - if in.BoundVolumeSnapshotContentName != nil { - in, out := &in.BoundVolumeSnapshotContentName, &out.BoundVolumeSnapshotContentName - *out = new(string) - **out = **in - } - if in.CreationTime != nil { - in, out := &in.CreationTime, &out.CreationTime - *out = (*in).DeepCopy() - } - if in.ReadyToUse != nil { - in, out := &in.ReadyToUse, &out.ReadyToUse - *out = new(bool) - **out = **in - } - if in.RestoreSize != nil { - in, out := &in.RestoreSize, &out.RestoreSize - x := (*in).DeepCopy() - *out = &x - } - if in.Error != nil { - in, out := &in.Error, &out.Error - *out = new(VolumeSnapshotError) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotStatus. -func (in *VolumeSnapshotStatus) DeepCopy() *VolumeSnapshotStatus { - if in == nil { - return nil - } - out := new(VolumeSnapshotStatus) - in.DeepCopyInto(out) - return out -} diff --git a/client/clientset/versioned/clientset.go b/client/clientset/versioned/clientset.go index 4c2a62c55..71d47a738 100644 --- a/client/clientset/versioned/clientset.go +++ b/client/clientset/versioned/clientset.go @@ -23,7 +23,6 @@ import ( "net/http" snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1" - snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -31,7 +30,6 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface SnapshotV1() snapshotv1.SnapshotV1Interface } @@ -39,13 +37,7 @@ type Interface interface { // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - snapshotV1beta1 *snapshotv1beta1.SnapshotV1beta1Client - snapshotV1 *snapshotv1.SnapshotV1Client -} - -// SnapshotV1beta1 retrieves the SnapshotV1beta1Client -func (c *Clientset) SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface { - return c.snapshotV1beta1 + snapshotV1 *snapshotv1.SnapshotV1Client } // SnapshotV1 retrieves the SnapshotV1Client @@ -93,10 +85,6 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error - cs.snapshotV1beta1, err = snapshotv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } cs.snapshotV1, err = snapshotv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -122,7 +110,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.snapshotV1beta1 = snapshotv1beta1.New(c) cs.snapshotV1 = snapshotv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/client/clientset/versioned/fake/clientset_generated.go b/client/clientset/versioned/fake/clientset_generated.go index 918c625df..b3ab82a6e 100644 --- a/client/clientset/versioned/fake/clientset_generated.go +++ b/client/clientset/versioned/fake/clientset_generated.go @@ -22,8 +22,6 @@ import ( clientset "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned" snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1" fakesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1/fake" - snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1" - fakesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -81,11 +79,6 @@ var ( _ testing.FakeClient = &Clientset{} ) -// SnapshotV1beta1 retrieves the SnapshotV1beta1Client -func (c *Clientset) SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface { - return &fakesnapshotv1beta1.FakeSnapshotV1beta1{Fake: &c.Fake} -} - // SnapshotV1 retrieves the SnapshotV1Client func (c *Clientset) SnapshotV1() snapshotv1.SnapshotV1Interface { return &fakesnapshotv1.FakeSnapshotV1{Fake: &c.Fake} diff --git a/client/clientset/versioned/fake/register.go b/client/clientset/versioned/fake/register.go index 305a7c75f..489359ce5 100644 --- a/client/clientset/versioned/fake/register.go +++ b/client/clientset/versioned/fake/register.go @@ -20,7 +20,6 @@ package fake import ( snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,7 +31,6 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - snapshotv1beta1.AddToScheme, snapshotv1.AddToScheme, } diff --git a/client/clientset/versioned/scheme/register.go b/client/clientset/versioned/scheme/register.go index 19669e47a..60f4addd4 100644 --- a/client/clientset/versioned/scheme/register.go +++ b/client/clientset/versioned/scheme/register.go @@ -20,7 +20,6 @@ package scheme import ( snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,7 +31,6 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - snapshotv1beta1.AddToScheme, snapshotv1.AddToScheme, } diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/doc.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/doc.go deleted file mode 100644 index 890a21e05..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1beta1 diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/doc.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/doc.go deleted file mode 100644 index dd9e9e4c8..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot.go deleted file mode 100644 index f2acab242..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVolumeSnapshots implements VolumeSnapshotInterface -type FakeVolumeSnapshots struct { - Fake *FakeSnapshotV1beta1 - ns string -} - -var volumesnapshotsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Resource: "volumesnapshots"} - -var volumesnapshotsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Kind: "VolumeSnapshot"} - -// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any. -func (c *FakeVolumeSnapshots) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshot, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(volumesnapshotsResource, c.ns, name), &v1beta1.VolumeSnapshot{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshot), err -} - -// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors. -func (c *FakeVolumeSnapshots) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(volumesnapshotsResource, volumesnapshotsKind, c.ns, opts), &v1beta1.VolumeSnapshotList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.VolumeSnapshotList{ListMeta: obj.(*v1beta1.VolumeSnapshotList).ListMeta} - for _, item := range obj.(*v1beta1.VolumeSnapshotList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshots. -func (c *FakeVolumeSnapshots) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(volumesnapshotsResource, c.ns, opts)) - -} - -// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. -func (c *FakeVolumeSnapshots) Create(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshot, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &v1beta1.VolumeSnapshot{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshot), err -} - -// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. -func (c *FakeVolumeSnapshots) Update(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshot, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &v1beta1.VolumeSnapshot{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshot), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVolumeSnapshots) UpdateStatus(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshot, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(volumesnapshotsResource, "status", c.ns, volumeSnapshot), &v1beta1.VolumeSnapshot{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshot), err -} - -// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs. -func (c *FakeVolumeSnapshots) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(volumesnapshotsResource, c.ns, name, opts), &v1beta1.VolumeSnapshot{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVolumeSnapshots) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(volumesnapshotsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1beta1.VolumeSnapshotList{}) - return err -} - -// Patch applies the patch and returns the patched volumeSnapshot. -func (c *FakeVolumeSnapshots) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshot, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(volumesnapshotsResource, c.ns, name, pt, data, subresources...), &v1beta1.VolumeSnapshot{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshot), err -} diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot_client.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot_client.go deleted file mode 100644 index 52f79b644..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot_client.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeSnapshotV1beta1 struct { - *testing.Fake -} - -func (c *FakeSnapshotV1beta1) VolumeSnapshots(namespace string) v1beta1.VolumeSnapshotInterface { - return &FakeVolumeSnapshots{c, namespace} -} - -func (c *FakeSnapshotV1beta1) VolumeSnapshotClasses() v1beta1.VolumeSnapshotClassInterface { - return &FakeVolumeSnapshotClasses{c} -} - -func (c *FakeSnapshotV1beta1) VolumeSnapshotContents() v1beta1.VolumeSnapshotContentInterface { - return &FakeVolumeSnapshotContents{c} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeSnapshotV1beta1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotclass.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotclass.go deleted file mode 100644 index 97663878b..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotclass.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVolumeSnapshotClasses implements VolumeSnapshotClassInterface -type FakeVolumeSnapshotClasses struct { - Fake *FakeSnapshotV1beta1 -} - -var volumesnapshotclassesResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Resource: "volumesnapshotclasses"} - -var volumesnapshotclassesKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Kind: "VolumeSnapshotClass"} - -// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any. -func (c *FakeVolumeSnapshotClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(volumesnapshotclassesResource, name), &v1beta1.VolumeSnapshotClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotClass), err -} - -// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors. -func (c *FakeVolumeSnapshotClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotClassList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(volumesnapshotclassesResource, volumesnapshotclassesKind, opts), &v1beta1.VolumeSnapshotClassList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.VolumeSnapshotClassList{ListMeta: obj.(*v1beta1.VolumeSnapshotClassList).ListMeta} - for _, item := range obj.(*v1beta1.VolumeSnapshotClassList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshotClasses. -func (c *FakeVolumeSnapshotClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(volumesnapshotclassesResource, opts)) -} - -// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any. -func (c *FakeVolumeSnapshotClasses) Create(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(volumesnapshotclassesResource, volumeSnapshotClass), &v1beta1.VolumeSnapshotClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotClass), err -} - -// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any. -func (c *FakeVolumeSnapshotClasses) Update(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(volumesnapshotclassesResource, volumeSnapshotClass), &v1beta1.VolumeSnapshotClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotClass), err -} - -// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs. -func (c *FakeVolumeSnapshotClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(volumesnapshotclassesResource, name, opts), &v1beta1.VolumeSnapshotClass{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVolumeSnapshotClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(volumesnapshotclassesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1beta1.VolumeSnapshotClassList{}) - return err -} - -// Patch applies the patch and returns the patched volumeSnapshotClass. -func (c *FakeVolumeSnapshotClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotclassesResource, name, pt, data, subresources...), &v1beta1.VolumeSnapshotClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotClass), err -} diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotcontent.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotcontent.go deleted file mode 100644 index 50440b85b..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotcontent.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVolumeSnapshotContents implements VolumeSnapshotContentInterface -type FakeVolumeSnapshotContents struct { - Fake *FakeSnapshotV1beta1 -} - -var volumesnapshotcontentsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Resource: "volumesnapshotcontents"} - -var volumesnapshotcontentsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Kind: "VolumeSnapshotContent"} - -// Get takes name of the volumeSnapshotContent, and returns the corresponding volumeSnapshotContent object, and an error if there is any. -func (c *FakeVolumeSnapshotContents) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(volumesnapshotcontentsResource, name), &v1beta1.VolumeSnapshotContent{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotContent), err -} - -// List takes label and field selectors, and returns the list of VolumeSnapshotContents that match those selectors. -func (c *FakeVolumeSnapshotContents) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotContentList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(volumesnapshotcontentsResource, volumesnapshotcontentsKind, opts), &v1beta1.VolumeSnapshotContentList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.VolumeSnapshotContentList{ListMeta: obj.(*v1beta1.VolumeSnapshotContentList).ListMeta} - for _, item := range obj.(*v1beta1.VolumeSnapshotContentList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshotContents. -func (c *FakeVolumeSnapshotContents) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(volumesnapshotcontentsResource, opts)) -} - -// Create takes the representation of a volumeSnapshotContent and creates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any. -func (c *FakeVolumeSnapshotContents) Create(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(volumesnapshotcontentsResource, volumeSnapshotContent), &v1beta1.VolumeSnapshotContent{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotContent), err -} - -// Update takes the representation of a volumeSnapshotContent and updates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any. -func (c *FakeVolumeSnapshotContents) Update(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(volumesnapshotcontentsResource, volumeSnapshotContent), &v1beta1.VolumeSnapshotContent{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotContent), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVolumeSnapshotContents) UpdateStatus(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshotContent, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(volumesnapshotcontentsResource, "status", volumeSnapshotContent), &v1beta1.VolumeSnapshotContent{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotContent), err -} - -// Delete takes name of the volumeSnapshotContent and deletes it. Returns an error if one occurs. -func (c *FakeVolumeSnapshotContents) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(volumesnapshotcontentsResource, name, opts), &v1beta1.VolumeSnapshotContent{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVolumeSnapshotContents) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(volumesnapshotcontentsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1beta1.VolumeSnapshotContentList{}) - return err -} - -// Patch applies the patch and returns the patched volumeSnapshotContent. -func (c *FakeVolumeSnapshotContents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotContent, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotcontentsResource, name, pt, data, subresources...), &v1beta1.VolumeSnapshotContent{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotContent), err -} diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/generated_expansion.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/generated_expansion.go deleted file mode 100644 index 306b86f04..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/generated_expansion.go +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -type VolumeSnapshotExpansion interface{} - -type VolumeSnapshotClassExpansion interface{} - -type VolumeSnapshotContentExpansion interface{} diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot.go deleted file mode 100644 index dfd5225c7..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - scheme "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VolumeSnapshotsGetter has a method to return a VolumeSnapshotInterface. -// A group's client should implement this interface. -type VolumeSnapshotsGetter interface { - VolumeSnapshots(namespace string) VolumeSnapshotInterface -} - -// VolumeSnapshotInterface has methods to work with VolumeSnapshot resources. -type VolumeSnapshotInterface interface { - Create(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.CreateOptions) (*v1beta1.VolumeSnapshot, error) - Update(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshot, error) - UpdateStatus(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshot, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.VolumeSnapshot, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.VolumeSnapshotList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshot, err error) - VolumeSnapshotExpansion -} - -// volumeSnapshots implements VolumeSnapshotInterface -type volumeSnapshots struct { - client rest.Interface - ns string -} - -// newVolumeSnapshots returns a VolumeSnapshots -func newVolumeSnapshots(c *SnapshotV1beta1Client, namespace string) *volumeSnapshots { - return &volumeSnapshots{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any. -func (c *volumeSnapshots) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshot, err error) { - result = &v1beta1.VolumeSnapshot{} - err = c.client.Get(). - Namespace(c.ns). - Resource("volumesnapshots"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors. -func (c *volumeSnapshots) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.VolumeSnapshotList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("volumesnapshots"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshots. -func (c *volumeSnapshots) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("volumesnapshots"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. -func (c *volumeSnapshots) Create(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshot, err error) { - result = &v1beta1.VolumeSnapshot{} - err = c.client.Post(). - Namespace(c.ns). - Resource("volumesnapshots"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshot). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. -func (c *volumeSnapshots) Update(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshot, err error) { - result = &v1beta1.VolumeSnapshot{} - err = c.client.Put(). - Namespace(c.ns). - Resource("volumesnapshots"). - Name(volumeSnapshot.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshot). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *volumeSnapshots) UpdateStatus(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshot, err error) { - result = &v1beta1.VolumeSnapshot{} - err = c.client.Put(). - Namespace(c.ns). - Resource("volumesnapshots"). - Name(volumeSnapshot.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshot). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs. -func (c *volumeSnapshots) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("volumesnapshots"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *volumeSnapshots) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("volumesnapshots"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched volumeSnapshot. -func (c *volumeSnapshots) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshot, err error) { - result = &v1beta1.VolumeSnapshot{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("volumesnapshots"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot_client.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot_client.go deleted file mode 100644 index 1e50945d2..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot_client.go +++ /dev/null @@ -1,117 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "net/http" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type SnapshotV1beta1Interface interface { - RESTClient() rest.Interface - VolumeSnapshotsGetter - VolumeSnapshotClassesGetter - VolumeSnapshotContentsGetter -} - -// SnapshotV1beta1Client is used to interact with features provided by the snapshot.storage.k8s.io group. -type SnapshotV1beta1Client struct { - restClient rest.Interface -} - -func (c *SnapshotV1beta1Client) VolumeSnapshots(namespace string) VolumeSnapshotInterface { - return newVolumeSnapshots(c, namespace) -} - -func (c *SnapshotV1beta1Client) VolumeSnapshotClasses() VolumeSnapshotClassInterface { - return newVolumeSnapshotClasses(c) -} - -func (c *SnapshotV1beta1Client) VolumeSnapshotContents() VolumeSnapshotContentInterface { - return newVolumeSnapshotContents(c) -} - -// NewForConfig creates a new SnapshotV1beta1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*SnapshotV1beta1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new SnapshotV1beta1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SnapshotV1beta1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &SnapshotV1beta1Client{client}, nil -} - -// NewForConfigOrDie creates a new SnapshotV1beta1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *SnapshotV1beta1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new SnapshotV1beta1Client for the given RESTClient. -func New(c rest.Interface) *SnapshotV1beta1Client { - return &SnapshotV1beta1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *SnapshotV1beta1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotclass.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotclass.go deleted file mode 100644 index 289a82c3e..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotclass.go +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - scheme "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VolumeSnapshotClassesGetter has a method to return a VolumeSnapshotClassInterface. -// A group's client should implement this interface. -type VolumeSnapshotClassesGetter interface { - VolumeSnapshotClasses() VolumeSnapshotClassInterface -} - -// VolumeSnapshotClassInterface has methods to work with VolumeSnapshotClass resources. -type VolumeSnapshotClassInterface interface { - Create(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.CreateOptions) (*v1beta1.VolumeSnapshotClass, error) - Update(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshotClass, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.VolumeSnapshotClass, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.VolumeSnapshotClassList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotClass, err error) - VolumeSnapshotClassExpansion -} - -// volumeSnapshotClasses implements VolumeSnapshotClassInterface -type volumeSnapshotClasses struct { - client rest.Interface -} - -// newVolumeSnapshotClasses returns a VolumeSnapshotClasses -func newVolumeSnapshotClasses(c *SnapshotV1beta1Client) *volumeSnapshotClasses { - return &volumeSnapshotClasses{ - client: c.RESTClient(), - } -} - -// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any. -func (c *volumeSnapshotClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - result = &v1beta1.VolumeSnapshotClass{} - err = c.client.Get(). - Resource("volumesnapshotclasses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors. -func (c *volumeSnapshotClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotClassList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.VolumeSnapshotClassList{} - err = c.client.Get(). - Resource("volumesnapshotclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshotClasses. -func (c *volumeSnapshotClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("volumesnapshotclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any. -func (c *volumeSnapshotClasses) Create(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - result = &v1beta1.VolumeSnapshotClass{} - err = c.client.Post(). - Resource("volumesnapshotclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotClass). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any. -func (c *volumeSnapshotClasses) Update(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - result = &v1beta1.VolumeSnapshotClass{} - err = c.client.Put(). - Resource("volumesnapshotclasses"). - Name(volumeSnapshotClass.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotClass). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs. -func (c *volumeSnapshotClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("volumesnapshotclasses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *volumeSnapshotClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("volumesnapshotclasses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched volumeSnapshotClass. -func (c *volumeSnapshotClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotClass, err error) { - result = &v1beta1.VolumeSnapshotClass{} - err = c.client.Patch(pt). - Resource("volumesnapshotclasses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotcontent.go b/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotcontent.go deleted file mode 100644 index 75767b0a4..000000000 --- a/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotcontent.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - scheme "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VolumeSnapshotContentsGetter has a method to return a VolumeSnapshotContentInterface. -// A group's client should implement this interface. -type VolumeSnapshotContentsGetter interface { - VolumeSnapshotContents() VolumeSnapshotContentInterface -} - -// VolumeSnapshotContentInterface has methods to work with VolumeSnapshotContent resources. -type VolumeSnapshotContentInterface interface { - Create(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.CreateOptions) (*v1beta1.VolumeSnapshotContent, error) - Update(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshotContent, error) - UpdateStatus(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshotContent, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.VolumeSnapshotContent, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.VolumeSnapshotContentList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotContent, err error) - VolumeSnapshotContentExpansion -} - -// volumeSnapshotContents implements VolumeSnapshotContentInterface -type volumeSnapshotContents struct { - client rest.Interface -} - -// newVolumeSnapshotContents returns a VolumeSnapshotContents -func newVolumeSnapshotContents(c *SnapshotV1beta1Client) *volumeSnapshotContents { - return &volumeSnapshotContents{ - client: c.RESTClient(), - } -} - -// Get takes name of the volumeSnapshotContent, and returns the corresponding volumeSnapshotContent object, and an error if there is any. -func (c *volumeSnapshotContents) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - result = &v1beta1.VolumeSnapshotContent{} - err = c.client.Get(). - Resource("volumesnapshotcontents"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VolumeSnapshotContents that match those selectors. -func (c *volumeSnapshotContents) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotContentList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.VolumeSnapshotContentList{} - err = c.client.Get(). - Resource("volumesnapshotcontents"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshotContents. -func (c *volumeSnapshotContents) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("volumesnapshotcontents"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a volumeSnapshotContent and creates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any. -func (c *volumeSnapshotContents) Create(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - result = &v1beta1.VolumeSnapshotContent{} - err = c.client.Post(). - Resource("volumesnapshotcontents"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotContent). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a volumeSnapshotContent and updates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any. -func (c *volumeSnapshotContents) Update(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - result = &v1beta1.VolumeSnapshotContent{} - err = c.client.Put(). - Resource("volumesnapshotcontents"). - Name(volumeSnapshotContent.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotContent). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *volumeSnapshotContents) UpdateStatus(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - result = &v1beta1.VolumeSnapshotContent{} - err = c.client.Put(). - Resource("volumesnapshotcontents"). - Name(volumeSnapshotContent.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotContent). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the volumeSnapshotContent and deletes it. Returns an error if one occurs. -func (c *volumeSnapshotContents) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("volumesnapshotcontents"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *volumeSnapshotContents) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("volumesnapshotcontents"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched volumeSnapshotContent. -func (c *volumeSnapshotContents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotContent, err error) { - result = &v1beta1.VolumeSnapshotContent{} - err = c.client.Patch(pt). - Resource("volumesnapshotcontents"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml index 8c8cfed06..46ddb9d00 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml @@ -68,55 +68,8 @@ spec: parameters: additionalProperties: type: string - description: parameters is a key-value map with storage driver specific parameters for creating snapshots. These values are opaque to Kubernetes. - type: object - required: - - deletionPolicy - - driver - type: object - served: true - storage: true - subresources: {} - - additionalPrinterColumns: - - jsonPath: .driver - name: Driver - type: string - - description: Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. - jsonPath: .deletionPolicy - name: DeletionPolicy - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1beta1 - # This indicates the v1beta1 version of the custom resource is deprecated. - # API requests to this version receive a warning in the server response. - deprecated: true - # This overrides the default warning returned to clients making v1beta1 API requests. - deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshotClass is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshotClass" - schema: - openAPIV3Schema: - description: VolumeSnapshotClass specifies parameters that a underlying storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses are non-namespaced - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - deletionPolicy: - description: deletionPolicy determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. Supported values are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. Required. - enum: - - Delete - - Retain - type: string - driver: - description: driver is the name of the storage driver that handles this VolumeSnapshotClass. Required. - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - parameters: - additionalProperties: - type: string - description: parameters is a key-value map with storage driver specific parameters for creating snapshots. These values are opaque to Kubernetes. + description: parameters is a key-value map with storage driver specific + parameters for creating snapshots. These values are opaque to Kubernetes. type: object required: - deletionPolicy diff --git a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml index f2a5784c0..f636a5f82 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml @@ -72,47 +72,85 @@ spec: submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' type: string spec: - description: spec defines properties of a VolumeSnapshotContent created by the underlying storage system. Required. + description: spec defines properties of a VolumeSnapshotContent created + by the underlying storage system. Required. properties: deletionPolicy: - description: deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. Supported values are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. For dynamically provisioned snapshots, this field will automatically be filled in by the CSI snapshotter sidecar with the "DeletionPolicy" field defined in the corresponding VolumeSnapshotClass. For pre-existing snapshots, users MUST specify this field when creating the VolumeSnapshotContent object. Required. + description: deletionPolicy determines whether this VolumeSnapshotContent + and its physical snapshot on the underlying storage system should + be deleted when its bound VolumeSnapshot is deleted. Supported values + are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent + and its physical snapshot on underlying storage system are kept. + "Delete" means that the VolumeSnapshotContent and its physical snapshot + on underlying storage system are deleted. For dynamically provisioned + snapshots, this field will automatically be filled in by the CSI + snapshotter sidecar with the "DeletionPolicy" field defined in the + corresponding VolumeSnapshotClass. For pre-existing snapshots, users + MUST specify this field when creating the VolumeSnapshotContent + object. Required. enum: - Delete - Retain type: string driver: - description: driver is the name of the CSI driver used to create the physical snapshot on the underlying storage system. This MUST be the same as the name returned by the CSI GetPluginName() call for that driver. Required. + description: driver is the name of the CSI driver used to create the + physical snapshot on the underlying storage system. This MUST be + the same as the name returned by the CSI GetPluginName() call for + that driver. Required. type: string source: - description: source specifies whether the snapshot is (or should be) dynamically provisioned or already exists, and just requires a Kubernetes object representation. This field is immutable after creation. Required. + description: source specifies whether the snapshot is (or should be) + dynamically provisioned or already exists, and just requires a Kubernetes + object representation. This field is immutable after creation. Required. properties: snapshotHandle: - description: snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on the underlying storage system for which a Kubernetes object representation was (or should be) created. This field is immutable. + description: snapshotHandle specifies the CSI "snapshot_id" of + a pre-existing snapshot on the underlying storage system for + which a Kubernetes object representation was (or should be) + created. This field is immutable. type: string volumeHandle: - description: volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot should be dynamically taken from. This field is immutable. + description: volumeHandle specifies the CSI "volume_id" of the + volume from which a snapshot should be dynamically taken from. + This field is immutable. type: string type: object - oneOf: - - required: ["snapshotHandle"] - - required: ["volumeHandle"] sourceVolumeMode: description: SourceVolumeMode is the mode of the volume whose snapshot - is taken. Can be either “Filesystem” or “Block”. If not specified, - it indicates the source volume's mode is unknown. - This field is immutable. This field is an alpha field. + is taken. Can be either “Filesystem” or “Block”. If not specified, + it indicates the source volume's mode is unknown. This field is + immutable. This field is an alpha field. type: string volumeSnapshotClassName: - description: name of the VolumeSnapshotClass from which this snapshot was (or will be) created. Note that after provisioning, the VolumeSnapshotClass may be deleted or recreated with different set of values, and as such, should not be referenced post-snapshot creation. + description: name of the VolumeSnapshotClass from which this snapshot + was (or will be) created. Note that after provisioning, the VolumeSnapshotClass + may be deleted or recreated with different set of values, and as + such, should not be referenced post-snapshot creation. type: string volumeSnapshotRef: - description: volumeSnapshotRef specifies the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to this VolumeSnapshotContent's name for the bidirectional binding to be valid. For a pre-existing VolumeSnapshotContent object, name and namespace of the VolumeSnapshot object MUST be provided for binding to happen. This field is immutable after creation. Required. + description: volumeSnapshotRef specifies the VolumeSnapshot object + to which this VolumeSnapshotContent object is bound. VolumeSnapshot.Spec.VolumeSnapshotContentName + field must reference to this VolumeSnapshotContent's name for the + bidirectional binding to be valid. For a pre-existing VolumeSnapshotContent + object, name and namespace of the VolumeSnapshot object MUST be + provided for binding to happen. This field is immutable after creation. + Required. properties: apiVersion: description: API version of the referent. type: string fieldPath: - description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.' + description: 'If referring to a piece of an object instead of + an entire object, this string should contain a valid JSON/Go + field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within + a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" + (container with index 2 in this pod). This syntax is chosen + only to have some well-defined way of referencing a part of + an object. TODO: this design is not final and this field is + subject to change in the future.' type: string kind: description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' @@ -124,7 +162,8 @@ spec: description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' type: string resourceVersion: - description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' type: string uid: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' @@ -140,14 +179,27 @@ spec: description: status represents the current information of a snapshot. properties: creationTime: - description: creationTime is the timestamp when the point-in-time snapshot is taken by the underlying storage system. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "creation_time" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "creation_time" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. If not specified, it indicates the creation time is unknown. 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. + description: creationTime is the timestamp when the point-in-time + snapshot is taken by the underlying storage system. In dynamic snapshot + creation case, this field will be filled in by the CSI snapshotter + sidecar with the "creation_time" value returned from CSI "CreateSnapshot" + gRPC call. For a pre-existing snapshot, this field will be filled + with the "creation_time" value returned from the CSI "ListSnapshots" + gRPC call if the driver supports it. If not specified, it indicates + the creation time is unknown. 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. format: int64 type: integer error: - description: error is the last observed error during snapshot creation, if any. Upon success after retry, this error field will be cleared. + description: error is the last observed error during snapshot creation, + if any. Upon success after retry, this error field will be cleared. properties: message: - description: 'message is a string detailing the encountered error during snapshot creation if specified. NOTE: message may be logged, and it should not contain sensitive information.' + description: 'message is a string detailing the encountered error + during snapshot creation if specified. NOTE: message may be + logged, and it should not contain sensitive information.' type: string time: description: time is the timestamp when the error was encountered. @@ -155,15 +207,34 @@ spec: type: string type: object readyToUse: - description: readyToUse indicates if a snapshot is ready to be used to restore a volume. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "ready_to_use" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "ready_to_use" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, otherwise, this field will be set to "True". If not specified, it means the readiness of a snapshot is unknown. + description: readyToUse indicates if a snapshot is ready to be used + to restore a volume. In dynamic snapshot creation case, this field + will be filled in by the CSI snapshotter sidecar with the "ready_to_use" + value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing + snapshot, this field will be filled with the "ready_to_use" value + returned from the CSI "ListSnapshots" gRPC call if the driver supports + it, otherwise, this field will be set to "True". If not specified, + it means the readiness of a snapshot is unknown. type: boolean restoreSize: - description: restoreSize represents the complete size of the snapshot in bytes. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "size_bytes" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "size_bytes" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. When restoring a volume from this snapshot, the size of the volume MUST NOT be smaller than the restoreSize if it is specified, otherwise the restoration will fail. If not specified, it indicates that the size is unknown. + description: restoreSize represents the complete size of the snapshot + in bytes. In dynamic snapshot creation case, this field will be + filled in by the CSI snapshotter sidecar with the "size_bytes" value + returned from CSI "CreateSnapshot" gRPC call. For a pre-existing + snapshot, this field will be filled with the "size_bytes" value + returned from the CSI "ListSnapshots" gRPC call if the driver supports + it. When restoring a volume from this snapshot, the size of the + volume MUST NOT be smaller than the restoreSize if it is specified, + otherwise the restoration will fail. If not specified, it indicates + that the size is unknown. format: int64 minimum: 0 type: integer snapshotHandle: - description: snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system. If not specified, it indicates that dynamic snapshot creation has either failed or it is still in progress. + description: snapshotHandle is the CSI "snapshot_id" of a snapshot + on the underlying storage system. If not specified, it indicates + that dynamic snapshot creation has either failed or it is still + in progress. type: string type: object required: @@ -173,147 +244,6 @@ spec: storage: true subresources: status: {} - - additionalPrinterColumns: - - description: Indicates if the snapshot is ready to be used to restore a volume. - jsonPath: .status.readyToUse - name: ReadyToUse - type: boolean - - description: Represents the complete size of the snapshot in bytes - jsonPath: .status.restoreSize - name: RestoreSize - type: integer - - description: Determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. - jsonPath: .spec.deletionPolicy - name: DeletionPolicy - type: string - - description: Name of the CSI driver used to create the physical snapshot on the underlying storage system. - jsonPath: .spec.driver - name: Driver - type: string - - description: Name of the VolumeSnapshotClass to which this snapshot belongs. - jsonPath: .spec.volumeSnapshotClassName - name: VolumeSnapshotClass - type: string - - description: Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. - jsonPath: .spec.volumeSnapshotRef.name - name: VolumeSnapshot - type: string - - description: Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. - jsonPath: .spec.volumeSnapshotRef.namespace - name: VolumeSnapshotNamespace - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1beta1 - # This indicates the v1beta1 version of the custom resource is deprecated. - # API requests to this version receive a warning in the server response. - deprecated: true - # This overrides the default warning returned to clients making v1beta1 API requests. - deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshotContent is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshotContent" - schema: - openAPIV3Schema: - description: VolumeSnapshotContent represents the actual "on-disk" snapshot object in the underlying storage system - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - spec: - description: spec defines properties of a VolumeSnapshotContent created by the underlying storage system. Required. - properties: - deletionPolicy: - description: deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. Supported values are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. For dynamically provisioned snapshots, this field will automatically be filled in by the CSI snapshotter sidecar with the "DeletionPolicy" field defined in the corresponding VolumeSnapshotClass. For pre-existing snapshots, users MUST specify this field when creating the VolumeSnapshotContent object. Required. - enum: - - Delete - - Retain - type: string - driver: - description: driver is the name of the CSI driver used to create the physical snapshot on the underlying storage system. This MUST be the same as the name returned by the CSI GetPluginName() call for that driver. Required. - type: string - source: - description: source specifies whether the snapshot is (or should be) dynamically provisioned or already exists, and just requires a Kubernetes object representation. This field is immutable after creation. Required. - properties: - snapshotHandle: - description: snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on the underlying storage system for which a Kubernetes object representation was (or should be) created. This field is immutable. - type: string - volumeHandle: - description: volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot should be dynamically taken from. This field is immutable. - type: string - type: object - volumeSnapshotClassName: - description: name of the VolumeSnapshotClass from which this snapshot was (or will be) created. Note that after provisioning, the VolumeSnapshotClass may be deleted or recreated with different set of values, and as such, should not be referenced post-snapshot creation. - type: string - volumeSnapshotRef: - description: volumeSnapshotRef specifies the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to this VolumeSnapshotContent's name for the bidirectional binding to be valid. For a pre-existing VolumeSnapshotContent object, name and namespace of the VolumeSnapshot object MUST be provided for binding to happen. This field is immutable after creation. Required. - properties: - apiVersion: - description: API version of the referent. - type: string - fieldPath: - description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.' - type: string - kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' - type: string - namespace: - description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' - type: string - resourceVersion: - description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' - type: string - uid: - description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' - type: string - type: object - required: - - deletionPolicy - - driver - - source - - volumeSnapshotRef - type: object - status: - description: status represents the current information of a snapshot. - properties: - creationTime: - description: creationTime is the timestamp when the point-in-time snapshot is taken by the underlying storage system. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "creation_time" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "creation_time" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. If not specified, it indicates the creation time is unknown. 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. - format: int64 - type: integer - error: - description: error is the last observed error during snapshot creation, if any. Upon success after retry, this error field will be cleared. - properties: - message: - description: 'message is a string detailing the encountered error during snapshot creation if specified. NOTE: message may be logged, and it should not contain sensitive information.' - type: string - time: - description: time is the timestamp when the error was encountered. - format: date-time - type: string - type: object - readyToUse: - description: readyToUse indicates if a snapshot is ready to be used to restore a volume. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "ready_to_use" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "ready_to_use" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, otherwise, this field will be set to "True". If not specified, it means the readiness of a snapshot is unknown. - type: boolean - restoreSize: - description: restoreSize represents the complete size of the snapshot in bytes. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "size_bytes" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "size_bytes" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. When restoring a volume from this snapshot, the size of the volume MUST NOT be smaller than the restoreSize if it is specified, otherwise the restoration will fail. If not specified, it indicates that the size is unknown. - format: int64 - minimum: 0 - type: integer - snapshotHandle: - description: snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system. If not specified, it indicates that dynamic snapshot creation has either failed or it is still in progress. - type: string - type: object - required: - - spec - type: object - served: true - storage: false - subresources: - status: {} status: acceptedNames: kind: "" diff --git a/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml b/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml index 4029dd001..fd9712c40 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml @@ -100,8 +100,8 @@ spec: type: string type: object oneOf: - - required: ["persistentVolumeClaimName"] - - required: ["volumeSnapshotContentName"] + - required: [ "persistentVolumeClaimName" ] + - required: [ "volumeSnapshotContentName" ] volumeSnapshotClassName: description: 'VolumeSnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot. VolumeSnapshotClassName may be @@ -196,110 +196,6 @@ spec: storage: true subresources: status: {} - - additionalPrinterColumns: - - description: Indicates if the snapshot is ready to be used to restore a volume. - jsonPath: .status.readyToUse - name: ReadyToUse - type: boolean - - description: If a new snapshot needs to be created, this contains the name of the source PVC from which this snapshot was (or will be) created. - jsonPath: .spec.source.persistentVolumeClaimName - name: SourcePVC - type: string - - description: If a snapshot already exists, this contains the name of the existing VolumeSnapshotContent object representing the existing snapshot. - jsonPath: .spec.source.volumeSnapshotContentName - name: SourceSnapshotContent - type: string - - description: Represents the minimum size of volume required to rehydrate from this snapshot. - jsonPath: .status.restoreSize - name: RestoreSize - type: string - - description: The name of the VolumeSnapshotClass requested by the VolumeSnapshot. - jsonPath: .spec.volumeSnapshotClassName - name: SnapshotClass - type: string - - description: Name of the VolumeSnapshotContent object to which the VolumeSnapshot object intends to bind to. Please note that verification of binding actually requires checking both VolumeSnapshot and VolumeSnapshotContent to ensure both are pointing at each other. Binding MUST be verified prior to usage of this object. - jsonPath: .status.boundVolumeSnapshotContentName - name: SnapshotContent - type: string - - description: Timestamp when the point-in-time snapshot was taken by the underlying storage system. - jsonPath: .status.creationTime - name: CreationTime - type: date - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1beta1 - # This indicates the v1beta1 version of the custom resource is deprecated. - # API requests to this version receive a warning in the server response. - deprecated: true - # This overrides the default warning returned to clients making v1beta1 API requests. - deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshot is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshot" - schema: - openAPIV3Schema: - description: VolumeSnapshot is a user's request for either creating a point-in-time snapshot of a persistent volume, or binding to a pre-existing snapshot. - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - spec: - description: 'spec defines the desired characteristics of a snapshot requested by a user. More info: https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots Required.' - properties: - source: - description: source specifies where a snapshot will be created from. This field is immutable after creation. Required. - properties: - persistentVolumeClaimName: - description: persistentVolumeClaimName specifies the name of the PersistentVolumeClaim object representing the volume from which a snapshot should be created. This PVC is assumed to be in the same namespace as the VolumeSnapshot object. This field should be set if the snapshot does not exists, and needs to be created. This field is immutable. - type: string - volumeSnapshotContentName: - description: volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent object representing an existing volume snapshot. This field should be set if the snapshot already exists and only needs a representation in Kubernetes. This field is immutable. - type: string - type: object - volumeSnapshotClassName: - description: 'VolumeSnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot. VolumeSnapshotClassName may be left nil to indicate that the default SnapshotClass should be used. A given cluster may have multiple default Volume SnapshotClasses: one default per CSI Driver. If a VolumeSnapshot does not specify a SnapshotClass, VolumeSnapshotSource will be checked to figure out what the associated CSI Driver is, and the default VolumeSnapshotClass associated with that CSI Driver will be used. If more than one VolumeSnapshotClass exist for a given CSI Driver and more than one have been marked as default, CreateSnapshot will fail and generate an event. Empty string is not allowed for this field.' - type: string - required: - - source - type: object - status: - description: status represents the current information of a snapshot. Consumers must verify binding between VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that both VolumeSnapshot and VolumeSnapshotContent point at each other) before using this object. - properties: - boundVolumeSnapshotContentName: - description: 'boundVolumeSnapshotContentName is the name of the VolumeSnapshotContent object to which this VolumeSnapshot object intends to bind to. If not specified, it indicates that the VolumeSnapshot object has not been successfully bound to a VolumeSnapshotContent object yet. NOTE: To avoid possible security issues, consumers must verify binding between VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that both VolumeSnapshot and VolumeSnapshotContent point at each other) before using this object.' - type: string - creationTime: - description: creationTime is the timestamp when the point-in-time snapshot is taken by the underlying storage system. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "creation_time" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "creation_time" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. If not specified, it may indicate that the creation time of the snapshot is unknown. - format: date-time - type: string - error: - description: error is the last observed error during snapshot creation, if any. This field could be helpful to upper level controllers(i.e., application controller) to decide whether they should continue on waiting for the snapshot to be created based on the type of error reported. The snapshot controller will keep retrying when an error occurs during the snapshot creation. Upon success, this error field will be cleared. - properties: - message: - description: 'message is a string detailing the encountered error during snapshot creation if specified. NOTE: message may be logged, and it should not contain sensitive information.' - type: string - time: - description: time is the timestamp when the error was encountered. - format: date-time - type: string - type: object - readyToUse: - description: readyToUse indicates if the snapshot is ready to be used to restore a volume. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "ready_to_use" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "ready_to_use" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, otherwise, this field will be set to "True". If not specified, it means the readiness of a snapshot is unknown. - type: boolean - restoreSize: - type: string - description: restoreSize represents the minimum size of volume required to create a volume from this snapshot. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "size_bytes" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "size_bytes" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. When restoring a volume from this snapshot, the size of the volume MUST NOT be smaller than the restoreSize if it is specified, otherwise the restoration will fail. If not specified, it indicates that the size is unknown. - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - required: - - spec - type: object - served: true - storage: false - subresources: - status: {} status: acceptedNames: kind: "" diff --git a/client/hack/README.md b/client/hack/README.md index 70c7632d1..b9b876b0a 100644 --- a/client/hack/README.md +++ b/client/hack/README.md @@ -54,8 +54,6 @@ Once you run the script, you will get an output as follows: ## update-crd.sh -NOTE: `v1beta1` APIs are deprecated and will be removed in a future release. - This is the script to update CRD yaml files under /client/config/crd/ based on types.go file. Make sure to run this script after making changes to /client/apis/volumesnapshot/v1/types.go. @@ -152,70 +150,4 @@ Update the restoreSize property to use type string only: volumeSnapshotClassName: ``` -* Because we need to serve both v1 and v1beta1 snapshot APIs, we need to make sure that both v1 and v1beta1 APIs are in the manifest yaml file. Because `update-crd.sh` only generates v1 manifest, make sure to copy the v1beta1 manifest below the v1 manifest after running `update-crd.sh` in the manifest yaml files. See `snapshot.storage.k8s.io_volumesnapshots.yaml` as an example. `served` is true for both v1beta1 and v1. `storage` is true for v1beta and false for v1. - -``` -spec: - group: snapshot.storage.k8s.io - names: - kind: VolumeSnapshot - listKind: VolumeSnapshotList - plural: volumesnapshots - singular: volumesnapshot - scope: Namespaced - versions: - - additionalPrinterColumns: - - description: Indicates if a snapshot is ready to be used to restore a volume. - jsonPath: .status.readyToUse - name: ReadyToUse - type: boolean -...... - - description: Timestamp when the point-in-time snapshot is taken by the underlying storage system. - jsonPath: .status.creationTime - name: CreationTime - type: date - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: VolumeSnapshot is a user's request for either creating a point-in-time snapshot of a persistent volume, or binding to a pre-existing snapshot. - properties: -...... - served: true - storage: false - subresources: - status: {} - - additionalPrinterColumns: - - description: Indicates if a snapshot is ready to be used to restore a volume. - jsonPath: .status.readyToUse - name: ReadyToUse - type: boolean -...... - - description: Timestamp when the point-in-time snapshot is taken by the underlying storage system. - jsonPath: .status.creationTime - name: CreationTime - type: date - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1beta1 - schema: - openAPIV3Schema: - description: VolumeSnapshot is a user's request for either creating a point-in-time snapshot of a persistent volume, or binding to a pre-existing snapshot. - properties: -...... - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`````` - * Add the VolumeSnapshot namespace to the `additionalPrinterColumns` section. Refer https://github.com/kubernetes-csi/external-snapshotter/pull/535 for more details. diff --git a/client/hack/update-generated-code.sh b/client/hack/update-generated-code.sh index 1821737f1..8a3e6040a 100755 --- a/client/hack/update-generated-code.sh +++ b/client/hack/update-generated-code.sh @@ -24,10 +24,9 @@ SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd) # --output-base because this script should also be able to run inside the vendor dir of # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir # instead of the $GOPATH directly. For normal projects this can be dropped. -# We should only be generating code for v1 now, while keeping the existing generated code for v1beta1 ${GOPATH}/src/k8s.io/code-generator/generate-groups.sh "deepcopy,client,informer,lister" \ github.com/kubernetes-csi/external-snapshotter/client/v6 github.com/kubernetes-csi/external-snapshotter/client/v6/apis \ - volumesnapshot:v1beta1,v1 \ + volumesnapshot:v1 \ --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt # To use your own boilerplate text use: diff --git a/client/informers/externalversions/generic.go b/client/informers/externalversions/generic.go index 7dcd7dbd1..ecf05aecd 100644 --- a/client/informers/externalversions/generic.go +++ b/client/informers/externalversions/generic.go @@ -22,7 +22,6 @@ import ( "fmt" v1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -61,14 +60,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1.SchemeGroupVersion.WithResource("volumesnapshotcontents"): return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1().VolumeSnapshotContents().Informer()}, nil - // Group=snapshot.storage.k8s.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("volumesnapshots"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1beta1().VolumeSnapshots().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("volumesnapshotclasses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1beta1().VolumeSnapshotClasses().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("volumesnapshotcontents"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1beta1().VolumeSnapshotContents().Informer()}, nil - } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/client/informers/externalversions/volumesnapshot/interface.go b/client/informers/externalversions/volumesnapshot/interface.go index b0bff475a..f71e5b12c 100644 --- a/client/informers/externalversions/volumesnapshot/interface.go +++ b/client/informers/externalversions/volumesnapshot/interface.go @@ -21,13 +21,10 @@ package volumesnapshot import ( internalinterfaces "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces" v1 "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1" - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1beta1 provides access to shared informers for resources in V1beta1. - V1beta1() v1beta1.Interface // V1 provides access to shared informers for resources in V1. V1() v1.Interface } @@ -43,11 +40,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1beta1 returns a new v1beta1.Interface. -func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) -} - // V1 returns a new v1.Interface. func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) diff --git a/client/informers/externalversions/volumesnapshot/v1beta1/interface.go b/client/informers/externalversions/volumesnapshot/v1beta1/interface.go deleted file mode 100644 index 2440590d1..000000000 --- a/client/informers/externalversions/volumesnapshot/v1beta1/interface.go +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - internalinterfaces "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // VolumeSnapshots returns a VolumeSnapshotInformer. - VolumeSnapshots() VolumeSnapshotInformer - // VolumeSnapshotClasses returns a VolumeSnapshotClassInformer. - VolumeSnapshotClasses() VolumeSnapshotClassInformer - // VolumeSnapshotContents returns a VolumeSnapshotContentInformer. - VolumeSnapshotContents() VolumeSnapshotContentInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// VolumeSnapshots returns a VolumeSnapshotInformer. -func (v *version) VolumeSnapshots() VolumeSnapshotInformer { - return &volumeSnapshotInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// VolumeSnapshotClasses returns a VolumeSnapshotClassInformer. -func (v *version) VolumeSnapshotClasses() VolumeSnapshotClassInformer { - return &volumeSnapshotClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// VolumeSnapshotContents returns a VolumeSnapshotContentInformer. -func (v *version) VolumeSnapshotContents() VolumeSnapshotContentInformer { - return &volumeSnapshotContentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} diff --git a/client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshot.go b/client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshot.go deleted file mode 100644 index 1ac8d3e0b..000000000 --- a/client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshot.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - time "time" - - volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - versioned "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned" - internalinterfaces "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotInformer provides access to a shared informer and lister for -// VolumeSnapshots. -type VolumeSnapshotInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta1.VolumeSnapshotLister -} - -type volumeSnapshotInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVolumeSnapshotInformer constructs a new informer for VolumeSnapshot type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVolumeSnapshotInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVolumeSnapshotInformer constructs a new informer for VolumeSnapshot type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVolumeSnapshotInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshots(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshots(namespace).Watch(context.TODO(), options) - }, - }, - &volumesnapshotv1beta1.VolumeSnapshot{}, - resyncPeriod, - indexers, - ) -} - -func (f *volumeSnapshotInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *volumeSnapshotInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&volumesnapshotv1beta1.VolumeSnapshot{}, f.defaultInformer) -} - -func (f *volumeSnapshotInformer) Lister() v1beta1.VolumeSnapshotLister { - return v1beta1.NewVolumeSnapshotLister(f.Informer().GetIndexer()) -} diff --git a/client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotclass.go b/client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotclass.go deleted file mode 100644 index 955910254..000000000 --- a/client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotclass.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - time "time" - - volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - versioned "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned" - internalinterfaces "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotClassInformer provides access to a shared informer and lister for -// VolumeSnapshotClasses. -type VolumeSnapshotClassInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta1.VolumeSnapshotClassLister -} - -type volumeSnapshotClassInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVolumeSnapshotClassInformer constructs a new informer for VolumeSnapshotClass type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVolumeSnapshotClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotClassInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVolumeSnapshotClassInformer constructs a new informer for VolumeSnapshotClass type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVolumeSnapshotClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshotClasses().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshotClasses().Watch(context.TODO(), options) - }, - }, - &volumesnapshotv1beta1.VolumeSnapshotClass{}, - resyncPeriod, - indexers, - ) -} - -func (f *volumeSnapshotClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *volumeSnapshotClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&volumesnapshotv1beta1.VolumeSnapshotClass{}, f.defaultInformer) -} - -func (f *volumeSnapshotClassInformer) Lister() v1beta1.VolumeSnapshotClassLister { - return v1beta1.NewVolumeSnapshotClassLister(f.Informer().GetIndexer()) -} diff --git a/client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotcontent.go b/client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotcontent.go deleted file mode 100644 index 88212df5f..000000000 --- a/client/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotcontent.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - time "time" - - volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - versioned "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned" - internalinterfaces "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotContentInformer provides access to a shared informer and lister for -// VolumeSnapshotContents. -type VolumeSnapshotContentInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta1.VolumeSnapshotContentLister -} - -type volumeSnapshotContentInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVolumeSnapshotContentInformer constructs a new informer for VolumeSnapshotContent type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVolumeSnapshotContentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotContentInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVolumeSnapshotContentInformer constructs a new informer for VolumeSnapshotContent type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVolumeSnapshotContentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshotContents().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshotContents().Watch(context.TODO(), options) - }, - }, - &volumesnapshotv1beta1.VolumeSnapshotContent{}, - resyncPeriod, - indexers, - ) -} - -func (f *volumeSnapshotContentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotContentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *volumeSnapshotContentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&volumesnapshotv1beta1.VolumeSnapshotContent{}, f.defaultInformer) -} - -func (f *volumeSnapshotContentInformer) Lister() v1beta1.VolumeSnapshotContentLister { - return v1beta1.NewVolumeSnapshotContentLister(f.Informer().GetIndexer()) -} diff --git a/client/listers/volumesnapshot/v1beta1/expansion_generated.go b/client/listers/volumesnapshot/v1beta1/expansion_generated.go deleted file mode 100644 index e4ebdf84c..000000000 --- a/client/listers/volumesnapshot/v1beta1/expansion_generated.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -// VolumeSnapshotListerExpansion allows custom methods to be added to -// VolumeSnapshotLister. -type VolumeSnapshotListerExpansion interface{} - -// VolumeSnapshotNamespaceListerExpansion allows custom methods to be added to -// VolumeSnapshotNamespaceLister. -type VolumeSnapshotNamespaceListerExpansion interface{} - -// VolumeSnapshotClassListerExpansion allows custom methods to be added to -// VolumeSnapshotClassLister. -type VolumeSnapshotClassListerExpansion interface{} - -// VolumeSnapshotContentListerExpansion allows custom methods to be added to -// VolumeSnapshotContentLister. -type VolumeSnapshotContentListerExpansion interface{} diff --git a/client/listers/volumesnapshot/v1beta1/volumesnapshot.go b/client/listers/volumesnapshot/v1beta1/volumesnapshot.go deleted file mode 100644 index 70a8d5ba7..000000000 --- a/client/listers/volumesnapshot/v1beta1/volumesnapshot.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotLister helps list VolumeSnapshots. -// All objects returned here must be treated as read-only. -type VolumeSnapshotLister interface { - // List lists all VolumeSnapshots in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error) - // VolumeSnapshots returns an object that can list and get VolumeSnapshots. - VolumeSnapshots(namespace string) VolumeSnapshotNamespaceLister - VolumeSnapshotListerExpansion -} - -// volumeSnapshotLister implements the VolumeSnapshotLister interface. -type volumeSnapshotLister struct { - indexer cache.Indexer -} - -// NewVolumeSnapshotLister returns a new VolumeSnapshotLister. -func NewVolumeSnapshotLister(indexer cache.Indexer) VolumeSnapshotLister { - return &volumeSnapshotLister{indexer: indexer} -} - -// List lists all VolumeSnapshots in the indexer. -func (s *volumeSnapshotLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VolumeSnapshot)) - }) - return ret, err -} - -// VolumeSnapshots returns an object that can list and get VolumeSnapshots. -func (s *volumeSnapshotLister) VolumeSnapshots(namespace string) VolumeSnapshotNamespaceLister { - return volumeSnapshotNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VolumeSnapshotNamespaceLister helps list and get VolumeSnapshots. -// All objects returned here must be treated as read-only. -type VolumeSnapshotNamespaceLister interface { - // List lists all VolumeSnapshots in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error) - // Get retrieves the VolumeSnapshot from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.VolumeSnapshot, error) - VolumeSnapshotNamespaceListerExpansion -} - -// volumeSnapshotNamespaceLister implements the VolumeSnapshotNamespaceLister -// interface. -type volumeSnapshotNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VolumeSnapshots in the indexer for a given namespace. -func (s volumeSnapshotNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VolumeSnapshot)) - }) - return ret, err -} - -// Get retrieves the VolumeSnapshot from the indexer for a given namespace and name. -func (s volumeSnapshotNamespaceLister) Get(name string) (*v1beta1.VolumeSnapshot, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("volumesnapshot"), name) - } - return obj.(*v1beta1.VolumeSnapshot), nil -} diff --git a/client/listers/volumesnapshot/v1beta1/volumesnapshotclass.go b/client/listers/volumesnapshot/v1beta1/volumesnapshotclass.go deleted file mode 100644 index 332b55314..000000000 --- a/client/listers/volumesnapshot/v1beta1/volumesnapshotclass.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotClassLister helps list VolumeSnapshotClasses. -// All objects returned here must be treated as read-only. -type VolumeSnapshotClassLister interface { - // List lists all VolumeSnapshotClasses in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotClass, err error) - // Get retrieves the VolumeSnapshotClass from the index for a given name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.VolumeSnapshotClass, error) - VolumeSnapshotClassListerExpansion -} - -// volumeSnapshotClassLister implements the VolumeSnapshotClassLister interface. -type volumeSnapshotClassLister struct { - indexer cache.Indexer -} - -// NewVolumeSnapshotClassLister returns a new VolumeSnapshotClassLister. -func NewVolumeSnapshotClassLister(indexer cache.Indexer) VolumeSnapshotClassLister { - return &volumeSnapshotClassLister{indexer: indexer} -} - -// List lists all VolumeSnapshotClasses in the indexer. -func (s *volumeSnapshotClassLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotClass, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VolumeSnapshotClass)) - }) - return ret, err -} - -// Get retrieves the VolumeSnapshotClass from the index for a given name. -func (s *volumeSnapshotClassLister) Get(name string) (*v1beta1.VolumeSnapshotClass, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("volumesnapshotclass"), name) - } - return obj.(*v1beta1.VolumeSnapshotClass), nil -} diff --git a/client/listers/volumesnapshot/v1beta1/volumesnapshotcontent.go b/client/listers/volumesnapshot/v1beta1/volumesnapshotcontent.go deleted file mode 100644 index 036e3e7c1..000000000 --- a/client/listers/volumesnapshot/v1beta1/volumesnapshotcontent.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotContentLister helps list VolumeSnapshotContents. -// All objects returned here must be treated as read-only. -type VolumeSnapshotContentLister interface { - // List lists all VolumeSnapshotContents in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotContent, err error) - // Get retrieves the VolumeSnapshotContent from the index for a given name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.VolumeSnapshotContent, error) - VolumeSnapshotContentListerExpansion -} - -// volumeSnapshotContentLister implements the VolumeSnapshotContentLister interface. -type volumeSnapshotContentLister struct { - indexer cache.Indexer -} - -// NewVolumeSnapshotContentLister returns a new VolumeSnapshotContentLister. -func NewVolumeSnapshotContentLister(indexer cache.Indexer) VolumeSnapshotContentLister { - return &volumeSnapshotContentLister{indexer: indexer} -} - -// List lists all VolumeSnapshotContents in the indexer. -func (s *volumeSnapshotContentLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotContent, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VolumeSnapshotContent)) - }) - return ret, err -} - -// Get retrieves the VolumeSnapshotContent from the index for a given name. -func (s *volumeSnapshotContentLister) Get(name string) (*v1beta1.VolumeSnapshotContent, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("volumesnapshotcontent"), name) - } - return obj.(*v1beta1.VolumeSnapshotContent), nil -} From 6b8e9d75a03ac25d8de7f0042d3151d1621833c7 Mon Sep 17 00:00:00 2001 From: Raunak Pradip Shah Date: Wed, 11 May 2022 12:13:27 +0530 Subject: [PATCH 2/4] Remove v1beta1 references from validation webhook --- pkg/validation-webhook/snapshot.go | 136 +----- pkg/validation-webhook/snapshot_test.go | 350 --------------- pkg/validation-webhook/validation.go | 50 --- .../v6/apis/volumesnapshot/v1beta1/doc.go | 20 - .../apis/volumesnapshot/v1beta1/register.go | 58 --- .../v6/apis/volumesnapshot/v1beta1/types.go | 395 ---------------- .../v1beta1/zz_generated.deepcopy.go | 425 ------------------ .../v6/clientset/versioned/clientset.go | 15 +- .../versioned/fake/clientset_generated.go | 7 - .../v6/clientset/versioned/fake/register.go | 2 - .../v6/clientset/versioned/scheme/register.go | 2 - .../typed/volumesnapshot/v1beta1/doc.go | 20 - .../typed/volumesnapshot/v1beta1/fake/doc.go | 20 - .../v1beta1/fake/fake_volumesnapshot.go | 142 ------ .../fake/fake_volumesnapshot_client.go | 48 -- .../v1beta1/fake/fake_volumesnapshotclass.go | 122 ----- .../fake/fake_volumesnapshotcontent.go | 133 ------ .../v1beta1/generated_expansion.go | 25 -- .../volumesnapshot/v1beta1/volumesnapshot.go | 195 -------- .../v1beta1/volumesnapshot_client.go | 117 ----- .../v1beta1/volumesnapshotclass.go | 168 ------- .../v1beta1/volumesnapshotcontent.go | 184 -------- .../v6/informers/externalversions/generic.go | 9 - .../volumesnapshot/interface.go | 8 - .../volumesnapshot/v1beta1/interface.go | 59 --- .../volumesnapshot/v1beta1/volumesnapshot.go | 90 ---- .../v1beta1/volumesnapshotclass.go | 89 ---- .../v1beta1/volumesnapshotcontent.go | 89 ---- .../v1beta1/expansion_generated.go | 35 -- .../volumesnapshot/v1beta1/volumesnapshot.go | 99 ---- .../v1beta1/volumesnapshotclass.go | 68 --- .../v1beta1/volumesnapshotcontent.go | 68 --- vendor/modules.txt | 10 +- 33 files changed, 7 insertions(+), 3251 deletions(-) delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/doc.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/register.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/types.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/doc.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/doc.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot_client.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotclass.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotcontent.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/generated_expansion.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot_client.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotclass.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotcontent.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/interface.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshot.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotclass.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotcontent.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/expansion_generated.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshot.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshotclass.go delete mode 100644 vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshotcontent.go diff --git a/pkg/validation-webhook/snapshot.go b/pkg/validation-webhook/snapshot.go index e7ec4c181..c417ff1e6 100644 --- a/pkg/validation-webhook/snapshot.go +++ b/pkg/validation-webhook/snapshot.go @@ -21,7 +21,6 @@ import ( "reflect" volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" storagelisters "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1" "github.com/kubernetes-csi/external-snapshotter/v6/pkg/utils" v1 "k8s.io/api/admission/v1" @@ -31,12 +30,8 @@ import ( ) var ( - // SnapshotV1Beta1GVR is GroupVersionResource for v1beta1 VolumeSnapshots - SnapshotV1Beta1GVR = metav1.GroupVersionResource{Group: volumesnapshotv1beta1.GroupName, Version: "v1beta1", Resource: "volumesnapshots"} // SnapshotV1GVR is GroupVersionResource for v1 VolumeSnapshots SnapshotV1GVR = metav1.GroupVersionResource{Group: volumesnapshotv1.GroupName, Version: "v1", Resource: "volumesnapshots"} - // SnapshotContentV1Beta1GVR is GroupVersionResource for v1beta1 VolumeSnapshotContents - SnapshotContentV1Beta1GVR = metav1.GroupVersionResource{Group: volumesnapshotv1beta1.GroupName, Version: "v1beta1", Resource: "volumesnapshotcontents"} // SnapshotContentV1GVR is GroupVersionResource for v1 VolumeSnapshotContents SnapshotContentV1GVR = metav1.GroupVersionResource{Group: volumesnapshotv1.GroupName, Version: "v1", Resource: "volumesnapshotcontents"} // SnapshotContentV1GVR is GroupVersionResource for v1 VolumeSnapshotContents @@ -77,18 +72,6 @@ func (a admitter) Admit(ar v1.AdmissionReview) *v1.AdmissionResponse { deserializer := codecs.UniversalDeserializer() switch ar.Request.Resource { - case SnapshotV1Beta1GVR: - snapshot := &volumesnapshotv1beta1.VolumeSnapshot{} - if _, _, err := deserializer.Decode(raw, nil, snapshot); err != nil { - klog.Error(err) - return toV1AdmissionResponse(err) - } - oldSnapshot := &volumesnapshotv1beta1.VolumeSnapshot{} - if _, _, err := deserializer.Decode(oldRaw, nil, oldSnapshot); err != nil { - klog.Error(err) - return toV1AdmissionResponse(err) - } - return decideSnapshotV1beta1(snapshot, oldSnapshot, isUpdate) case SnapshotV1GVR: snapshot := &volumesnapshotv1.VolumeSnapshot{} if _, _, err := deserializer.Decode(raw, nil, snapshot); err != nil { @@ -101,18 +84,6 @@ func (a admitter) Admit(ar v1.AdmissionReview) *v1.AdmissionResponse { return toV1AdmissionResponse(err) } return decideSnapshotV1(snapshot, oldSnapshot, isUpdate) - case SnapshotContentV1Beta1GVR: - snapcontent := &volumesnapshotv1beta1.VolumeSnapshotContent{} - if _, _, err := deserializer.Decode(raw, nil, snapcontent); err != nil { - klog.Error(err) - return toV1AdmissionResponse(err) - } - oldSnapcontent := &volumesnapshotv1beta1.VolumeSnapshotContent{} - if _, _, err := deserializer.Decode(oldRaw, nil, oldSnapcontent); err != nil { - klog.Error(err) - return toV1AdmissionResponse(err) - } - return decideSnapshotContentV1beta1(snapcontent, oldSnapcontent, isUpdate) case SnapshotContentV1GVR: snapcontent := &volumesnapshotv1.VolumeSnapshotContent{} if _, _, err := deserializer.Decode(raw, nil, snapcontent); err != nil { @@ -138,44 +109,12 @@ func (a admitter) Admit(ar v1.AdmissionReview) *v1.AdmissionResponse { } return decideSnapshotClassV1(snapClass, oldSnapClass, a.lister) default: - err := fmt.Errorf("expect resource to be %s or %s", SnapshotV1Beta1GVR, SnapshotContentV1Beta1GVR) + err := fmt.Errorf("expect resource to be %s, %s or %s", SnapshotV1GVR, SnapshotContentV1GVR, SnapshotClassV1GVR) klog.Error(err) return toV1AdmissionResponse(err) } } -func decideSnapshotV1beta1(snapshot, oldSnapshot *volumesnapshotv1beta1.VolumeSnapshot, isUpdate bool) *v1.AdmissionResponse { - reviewResponse := &v1.AdmissionResponse{ - Allowed: true, - Result: &metav1.Status{}, - } - - if isUpdate { - // if it is an UPDATE and oldSnapshot is not valid, then don't enforce strict validation - // This allows no-op updates to occur on snapshot resources which fail strict validation - // Which allows the remover of finalizers and therefore deletion of this object - // Don't rely on the pointers to be nil, because the deserialization method will convert it to - // The empty struct value. Instead check the operation type. - if err := ValidateV1Beta1Snapshot(oldSnapshot); err != nil { - return reviewResponse - } - - // if it is an UPDATE and oldSnapshot is valid, check immutable fields - if err := checkSnapshotImmutableFieldsV1beta1(snapshot, oldSnapshot); err != nil { - reviewResponse.Allowed = false - reviewResponse.Result.Message = err.Error() - return reviewResponse - } - } - // Enforce strict validation for CREATE requests. Immutable checks don't apply for CREATE requests. - // Enforce strict validation for UPDATE requests where old is valid and passes immutability check. - if err := ValidateV1Beta1Snapshot(snapshot); err != nil { - reviewResponse.Allowed = false - reviewResponse.Result.Message = err.Error() - } - return reviewResponse -} - func decideSnapshotV1(snapshot, oldSnapshot *volumesnapshotv1.VolumeSnapshot, isUpdate bool) *v1.AdmissionResponse { reviewResponse := &v1.AdmissionResponse{ Allowed: true, @@ -199,38 +138,6 @@ func decideSnapshotV1(snapshot, oldSnapshot *volumesnapshotv1.VolumeSnapshot, is return reviewResponse } -func decideSnapshotContentV1beta1(snapcontent, oldSnapcontent *volumesnapshotv1beta1.VolumeSnapshotContent, isUpdate bool) *v1.AdmissionResponse { - reviewResponse := &v1.AdmissionResponse{ - Allowed: true, - Result: &metav1.Status{}, - } - - if isUpdate { - // if it is an UPDATE and oldSnapcontent is not valid, then don't enforce strict validation - // This allows no-op updates to occur on snapshot resources which fail strict validation - // Which allows the remover of finalizers and therefore deletion of this object - // Don't rely on the pointers to be nil, because the deserialization method will convert it to - // The empty struct value. Instead check the operation type. - if err := ValidateV1Beta1SnapshotContent(oldSnapcontent); err != nil { - return reviewResponse - } - - // if it is an UPDATE and oldSnapcontent is valid, check immutable fields - if err := checkSnapshotContentImmutableFieldsV1beta1(snapcontent, oldSnapcontent); err != nil { - reviewResponse.Allowed = false - reviewResponse.Result.Message = err.Error() - return reviewResponse - } - } - // Enforce strict validation for all CREATE requests. Immutable checks don't apply for CREATE requests. - // Enforce strict validation for UPDATE requests where old is valid and passes immutability check. - if err := ValidateV1Beta1SnapshotContent(snapcontent); err != nil { - reviewResponse.Allowed = false - reviewResponse.Result.Message = err.Error() - } - return reviewResponse -} - func decideSnapshotContentV1(snapcontent, oldSnapcontent *volumesnapshotv1.VolumeSnapshotContent, isUpdate bool) *v1.AdmissionResponse { reviewResponse := &v1.AdmissionResponse{ Allowed: true, @@ -298,27 +205,6 @@ func strPtrDereference(s *string) string { return *s } -func checkSnapshotImmutableFieldsV1beta1(snapshot, oldSnapshot *volumesnapshotv1beta1.VolumeSnapshot) error { - if snapshot == nil { - return fmt.Errorf("VolumeSnapshot is nil") - } - if oldSnapshot == nil { - return fmt.Errorf("old VolumeSnapshot is nil") - } - - source := snapshot.Spec.Source - oldSource := oldSnapshot.Spec.Source - - if !reflect.DeepEqual(source.PersistentVolumeClaimName, oldSource.PersistentVolumeClaimName) { - return fmt.Errorf("Spec.Source.PersistentVolumeClaimName is immutable but was changed from %s to %s", strPtrDereference(oldSource.PersistentVolumeClaimName), strPtrDereference(source.PersistentVolumeClaimName)) - } - if !reflect.DeepEqual(source.VolumeSnapshotContentName, oldSource.VolumeSnapshotContentName) { - return fmt.Errorf("Spec.Source.VolumeSnapshotContentName is immutable but was changed from %s to %s", strPtrDereference(oldSource.VolumeSnapshotContentName), strPtrDereference(source.VolumeSnapshotContentName)) - } - - return nil -} - func checkSnapshotImmutableFieldsV1(snapshot, oldSnapshot *volumesnapshotv1.VolumeSnapshot) error { if snapshot == nil { return fmt.Errorf("VolumeSnapshot is nil") @@ -340,26 +226,6 @@ func checkSnapshotImmutableFieldsV1(snapshot, oldSnapshot *volumesnapshotv1.Volu return nil } -func checkSnapshotContentImmutableFieldsV1beta1(snapcontent, oldSnapcontent *volumesnapshotv1beta1.VolumeSnapshotContent) error { - if snapcontent == nil { - return fmt.Errorf("VolumeSnapshotContent is nil") - } - if oldSnapcontent == nil { - return fmt.Errorf("old VolumeSnapshotContent is nil") - } - - source := snapcontent.Spec.Source - oldSource := oldSnapcontent.Spec.Source - - if !reflect.DeepEqual(source.VolumeHandle, oldSource.VolumeHandle) { - return fmt.Errorf("Spec.Source.VolumeHandle is immutable but was changed from %s to %s", strPtrDereference(oldSource.VolumeHandle), strPtrDereference(source.VolumeHandle)) - } - if !reflect.DeepEqual(source.SnapshotHandle, oldSource.SnapshotHandle) { - return fmt.Errorf("Spec.Source.SnapshotHandle is immutable but was changed from %s to %s", strPtrDereference(oldSource.SnapshotHandle), strPtrDereference(source.SnapshotHandle)) - } - return nil -} - func checkSnapshotContentImmutableFieldsV1(snapcontent, oldSnapcontent *volumesnapshotv1.VolumeSnapshotContent) error { if snapcontent == nil { return fmt.Errorf("VolumeSnapshotContent is nil") diff --git a/pkg/validation-webhook/snapshot_test.go b/pkg/validation-webhook/snapshot_test.go index 796a067f2..980ab78f4 100644 --- a/pkg/validation-webhook/snapshot_test.go +++ b/pkg/validation-webhook/snapshot_test.go @@ -22,7 +22,6 @@ import ( "testing" volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" storagelisters "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1" "github.com/kubernetes-csi/external-snapshotter/v6/pkg/utils" v1 "k8s.io/api/admission/v1" @@ -32,204 +31,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" ) -func TestAdmitVolumeSnapshotV1beta1(t *testing.T) { - pvcname := "pvcname1" - mutatedField := "changed-immutable-field" - contentname := "snapcontent1" - volumeSnapshotClassName := "volume-snapshot-class-1" - emptyVolumeSnapshotClassName := "" - invalidErrorMsg := fmt.Sprintf("only one of Spec.Source.PersistentVolumeClaimName = %s and Spec.Source.VolumeSnapshotContentName = %s should be set", pvcname, contentname) - - testCases := []struct { - name string - volumeSnapshot *volumesnapshotv1beta1.VolumeSnapshot - oldVolumeSnapshot *volumesnapshotv1beta1.VolumeSnapshot - shouldAdmit bool - msg string - operation v1.Operation - }{ - { - name: "Delete: new and old are nil. Should admit", - volumeSnapshot: nil, - oldVolumeSnapshot: nil, - shouldAdmit: true, - operation: v1.Delete, - }, - { - name: "Create: old is nil and new is invalid", - volumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - PersistentVolumeClaimName: &pvcname, - VolumeSnapshotContentName: &contentname, - }, - }, - }, - oldVolumeSnapshot: nil, - shouldAdmit: false, - operation: v1.Create, - msg: invalidErrorMsg, - }, - { - name: "Create: old is nil and new is valid", - volumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - VolumeSnapshotContentName: &contentname, - }, - }, - }, - oldVolumeSnapshot: nil, - shouldAdmit: true, - operation: v1.Create, - }, - { - name: "Update: old is valid and new is invalid", - volumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - VolumeSnapshotContentName: &contentname, - }, - VolumeSnapshotClassName: &emptyVolumeSnapshotClassName, - }, - }, - oldVolumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - VolumeSnapshotContentName: &contentname, - }, - }, - }, - shouldAdmit: false, - operation: v1.Update, - msg: "Spec.VolumeSnapshotClassName must not be the empty string", - }, - { - name: "Update: old is valid and new is valid", - volumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - VolumeSnapshotContentName: &contentname, - }, - VolumeSnapshotClassName: &volumeSnapshotClassName, - }, - }, - oldVolumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - VolumeSnapshotContentName: &contentname, - }, - }, - }, - shouldAdmit: true, - operation: v1.Update, - }, - { - name: "Update: old is valid and new is valid but changes immutable field spec.source", - volumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - VolumeSnapshotContentName: &mutatedField, - }, - VolumeSnapshotClassName: &volumeSnapshotClassName, - }, - }, - oldVolumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - VolumeSnapshotContentName: &contentname, - }, - }, - }, - shouldAdmit: false, - operation: v1.Update, - msg: fmt.Sprintf("Spec.Source.VolumeSnapshotContentName is immutable but was changed from %s to %s", contentname, mutatedField), - }, - { - name: "Update: old is invalid and new is valid", - volumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - VolumeSnapshotContentName: &contentname, - }, - }, - }, - oldVolumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - PersistentVolumeClaimName: &pvcname, - VolumeSnapshotContentName: &contentname, - }, - }, - }, - shouldAdmit: true, - operation: v1.Update, - }, - { - name: "Update: old is invalid and new is invalid", - volumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - VolumeSnapshotContentName: &contentname, - PersistentVolumeClaimName: &pvcname, - }, - }, - }, - oldVolumeSnapshot: &volumesnapshotv1beta1.VolumeSnapshot{ - Spec: volumesnapshotv1beta1.VolumeSnapshotSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotSource{ - PersistentVolumeClaimName: &pvcname, - VolumeSnapshotContentName: &contentname, - }, - }, - }, - shouldAdmit: true, - operation: v1.Update, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - snapshot := tc.volumeSnapshot - raw, err := json.Marshal(snapshot) - if err != nil { - t.Fatal(err) - } - oldSnapshot := tc.oldVolumeSnapshot - oldRaw, err := json.Marshal(oldSnapshot) - if err != nil { - t.Fatal(err) - } - review := v1.AdmissionReview{ - Request: &v1.AdmissionRequest{ - Object: runtime.RawExtension{ - Raw: raw, - }, - OldObject: runtime.RawExtension{ - Raw: oldRaw, - }, - Resource: SnapshotV1Beta1GVR, - Operation: tc.operation, - }, - } - sa := NewSnapshotAdmitter(nil) - response := sa.Admit(review) - shouldAdmit := response.Allowed - msg := response.Result.Message - - expectedResponse := tc.shouldAdmit - expectedMsg := tc.msg - - if shouldAdmit != expectedResponse { - t.Errorf("expected \"%v\" to equal \"%v\"", shouldAdmit, expectedResponse) - } - if msg != expectedMsg { - t.Errorf("expected \"%v\" to equal \"%v\"", msg, expectedMsg) - } - }) - } -} - func TestAdmitVolumeSnapshotV1(t *testing.T) { pvcname := "pvcname1" mutatedField := "changed-immutable-field" @@ -414,157 +215,6 @@ func TestAdmitVolumeSnapshotV1(t *testing.T) { } } -func TestAdmitVolumeSnapshotContentV1beta1(t *testing.T) { - volumeHandle := "volumeHandle1" - modifiedField := "modified-field" - snapshotHandle := "snapshotHandle1" - volumeSnapshotClassName := "volume-snapshot-class-1" - validContent := &volumesnapshotv1beta1.VolumeSnapshotContent{ - Spec: volumesnapshotv1beta1.VolumeSnapshotContentSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotContentSource{ - SnapshotHandle: &snapshotHandle, - }, - VolumeSnapshotRef: core_v1.ObjectReference{ - Name: "snapshot-ref", - Namespace: "default-ns", - }, - VolumeSnapshotClassName: &volumeSnapshotClassName, - }, - } - invalidContent := &volumesnapshotv1beta1.VolumeSnapshotContent{ - Spec: volumesnapshotv1beta1.VolumeSnapshotContentSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotContentSource{ - SnapshotHandle: &snapshotHandle, - VolumeHandle: &volumeHandle, - }, - VolumeSnapshotRef: core_v1.ObjectReference{ - Name: "", - Namespace: "default-ns", - }, - }, - } - invalidErrorMsg := fmt.Sprintf("only one of Spec.Source.VolumeHandle = %s and Spec.Source.SnapshotHandle = %s should be set", volumeHandle, snapshotHandle) - testCases := []struct { - name string - volumeSnapshotContent *volumesnapshotv1beta1.VolumeSnapshotContent - oldVolumeSnapshotContent *volumesnapshotv1beta1.VolumeSnapshotContent - shouldAdmit bool - msg string - operation v1.Operation - }{ - { - name: "Delete: both new and old are nil", - volumeSnapshotContent: nil, - oldVolumeSnapshotContent: nil, - shouldAdmit: true, - operation: v1.Delete, - }, - { - name: "Create: old is nil and new is invalid", - volumeSnapshotContent: invalidContent, - oldVolumeSnapshotContent: nil, - shouldAdmit: false, - operation: v1.Create, - msg: invalidErrorMsg, - }, - { - name: "Create: old is nil and new is valid", - volumeSnapshotContent: validContent, - oldVolumeSnapshotContent: nil, - shouldAdmit: true, - operation: v1.Create, - }, - { - name: "Update: old is valid and new is invalid", - volumeSnapshotContent: invalidContent, - oldVolumeSnapshotContent: validContent, - shouldAdmit: false, - operation: v1.Update, - msg: fmt.Sprintf("Spec.Source.VolumeHandle is immutable but was changed from %s to %s", strPtrDereference(nil), volumeHandle), - }, - { - name: "Update: old is valid and new is valid", - volumeSnapshotContent: validContent, - oldVolumeSnapshotContent: validContent, - shouldAdmit: true, - operation: v1.Update, - }, - { - name: "Update: old is valid and new is valid but modifies immutable field", - volumeSnapshotContent: &volumesnapshotv1beta1.VolumeSnapshotContent{ - Spec: volumesnapshotv1beta1.VolumeSnapshotContentSpec{ - Source: volumesnapshotv1beta1.VolumeSnapshotContentSource{ - SnapshotHandle: &modifiedField, - }, - VolumeSnapshotRef: core_v1.ObjectReference{ - Name: "snapshot-ref", - Namespace: "default-ns", - }, - }, - }, - oldVolumeSnapshotContent: validContent, - shouldAdmit: false, - operation: v1.Update, - msg: fmt.Sprintf("Spec.Source.SnapshotHandle is immutable but was changed from %s to %s", snapshotHandle, modifiedField), - }, - { - name: "Update: old is invalid and new is valid", - volumeSnapshotContent: validContent, - oldVolumeSnapshotContent: invalidContent, - shouldAdmit: true, - operation: v1.Update, - }, - { - name: "Update: old is invalid and new is invalid", - volumeSnapshotContent: invalidContent, - oldVolumeSnapshotContent: invalidContent, - shouldAdmit: true, - operation: v1.Update, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - snapshotContent := tc.volumeSnapshotContent - raw, err := json.Marshal(snapshotContent) - if err != nil { - t.Fatal(err) - } - oldSnapshotContent := tc.oldVolumeSnapshotContent - oldRaw, err := json.Marshal(oldSnapshotContent) - if err != nil { - t.Fatal(err) - } - review := v1.AdmissionReview{ - Request: &v1.AdmissionRequest{ - Object: runtime.RawExtension{ - Raw: raw, - }, - OldObject: runtime.RawExtension{ - Raw: oldRaw, - }, - Resource: SnapshotContentV1Beta1GVR, - Operation: tc.operation, - }, - } - sa := NewSnapshotAdmitter(nil) - response := sa.Admit(review) - shouldAdmit := response.Allowed - msg := response.Result.Message - - expectedResponse := tc.shouldAdmit - expectedMsg := tc.msg - - if shouldAdmit != expectedResponse { - t.Errorf("expected \"%v\" to equal \"%v\"", shouldAdmit, expectedResponse) - } - if msg != expectedMsg { - t.Errorf("expected \"%v\" to equal \"%v\"", msg, expectedMsg) - } - }) - } -} - func TestAdmitVolumeSnapshotContentV1(t *testing.T) { volumeHandle := "volumeHandle1" modifiedField := "modified-field" diff --git a/pkg/validation-webhook/validation.go b/pkg/validation-webhook/validation.go index fa56bd698..b097c4223 100644 --- a/pkg/validation-webhook/validation.go +++ b/pkg/validation-webhook/validation.go @@ -20,7 +20,6 @@ import ( "fmt" crdv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - crdv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" ) // ValidateV1Snapshot performs additional strict validation. @@ -38,29 +37,6 @@ func ValidateV1Snapshot(snapshot *crdv1.VolumeSnapshot) error { return nil } -// ValidateV1Beta1Snapshot performs additional strict validation. -// Do NOT rely on this function to fully validate snapshot objects. -// This function will only check the additional rules provided by the webhook. -func ValidateV1Beta1Snapshot(snapshot *crdv1beta1.VolumeSnapshot) error { - if snapshot == nil { - return fmt.Errorf("VolumeSnapshot is nil") - } - - source := snapshot.Spec.Source - - if source.PersistentVolumeClaimName != nil && source.VolumeSnapshotContentName != nil { - return fmt.Errorf("only one of Spec.Source.PersistentVolumeClaimName = %s and Spec.Source.VolumeSnapshotContentName = %s should be set", *source.PersistentVolumeClaimName, *source.VolumeSnapshotContentName) - } - if source.PersistentVolumeClaimName == nil && source.VolumeSnapshotContentName == nil { - return fmt.Errorf("one of Spec.Source.PersistentVolumeClaimName and Spec.Source.VolumeSnapshotContentName should be set") - } - vscname := snapshot.Spec.VolumeSnapshotClassName - if vscname != nil && *vscname == "" { - return fmt.Errorf("Spec.VolumeSnapshotClassName must not be the empty string") - } - return nil -} - // ValidateV1SnapshotContent performs additional strict validation. // Do NOT rely on this function to fully validate snapshot content objects. // This function will only check the additional rules provided by the webhook. @@ -77,29 +53,3 @@ func ValidateV1SnapshotContent(snapcontent *crdv1.VolumeSnapshotContent) error { return nil } - -// ValidateV1Beta1SnapshotContent performs additional strict validation. -// Do NOT rely on this function to fully validate snapshot content objects. -// This function will only check the additional rules provided by the webhook. -func ValidateV1Beta1SnapshotContent(snapcontent *crdv1beta1.VolumeSnapshotContent) error { - if snapcontent == nil { - return fmt.Errorf("VolumeSnapshotContent is nil") - } - - source := snapcontent.Spec.Source - - if source.VolumeHandle != nil && source.SnapshotHandle != nil { - return fmt.Errorf("only one of Spec.Source.VolumeHandle = %s and Spec.Source.SnapshotHandle = %s should be set", *source.VolumeHandle, *source.SnapshotHandle) - } - if source.VolumeHandle == nil && source.SnapshotHandle == nil { - return fmt.Errorf("one of Spec.Source.VolumeHandle and Spec.Source.SnapshotHandle should be set") - } - - vsref := snapcontent.Spec.VolumeSnapshotRef - - if vsref.Name == "" || vsref.Namespace == "" { - return fmt.Errorf("both Spec.VolumeSnapshotRef.Name = %s and Spec.VolumeSnapshotRef.Namespace = %s must be set", vsref.Name, vsref.Namespace) - } - - return nil -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/doc.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/doc.go deleted file mode 100644 index d8a1f5dad..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// +k8s:deepcopy-gen=package -// +groupName=snapshot.storage.k8s.io - -package v1beta1 diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/register.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/register.go deleted file mode 100644 index 91f451424..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/register.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name use in this package. -const GroupName = "snapshot.storage.k8s.io" - -var ( - // SchemeBuilder is the new scheme builder - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - // AddToScheme adds to scheme - AddToScheme = SchemeBuilder.AddToScheme - // SchemeGroupVersion is the group version used to register these objects. - SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} -) - -// Resource takes an unqualified resource and returns a Group-qualified GroupResource. -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -func init() { - // We only register manually written functions here. The registration of the - // generated functions takes place in the generated files. The separation - // makes the code compile even when the generated files are missing. - SchemeBuilder.Register(addKnownTypes) -} - -// addKnownTypes adds the set of types defined in this package to the supplied scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &VolumeSnapshotClass{}, - &VolumeSnapshotClassList{}, - &VolumeSnapshot{}, - &VolumeSnapshotList{}, - &VolumeSnapshotContent{}, - &VolumeSnapshotContentList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/types.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/types.go deleted file mode 100644 index 0c672c11a..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/types.go +++ /dev/null @@ -1,395 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// +kubebuilder:object:generate=true -package v1beta1 - -import ( - core_v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VolumeSnapshot is a user's request for either creating a point-in-time -// snapshot of a persistent volume, or binding to a pre-existing snapshot. -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Namespaced,shortName=vs -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="ReadyToUse",type=boolean,JSONPath=`.status.readyToUse`,description="Indicates if a snapshot is ready to be used to restore a volume." -// +kubebuilder:printcolumn:name="SourcePVC",type=string,JSONPath=`.spec.source.persistentVolumeClaimName`,description="Name of the source PVC from where a dynamically taken snapshot will be created." -// +kubebuilder:printcolumn:name="SourceSnapshotContent",type=string,JSONPath=`.spec.source.volumeSnapshotContentName`,description="Name of the VolumeSnapshotContent which represents a pre-provisioned snapshot." -// +kubebuilder:printcolumn:name="RestoreSize",type=string,JSONPath=`.status.restoreSize`,description="Represents the complete size of the snapshot." -// +kubebuilder:printcolumn:name="SnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="The name of the VolumeSnapshotClass requested by the VolumeSnapshot." -// +kubebuilder:printcolumn:name="SnapshotContent",type=string,JSONPath=`.status.boundVolumeSnapshotContentName`,description="The name of the VolumeSnapshotContent to which this VolumeSnapshot is bound." -// +kubebuilder:printcolumn:name="CreationTime",type=date,JSONPath=`.status.creationTime`,description="Timestamp when the point-in-time snapshot is taken by the underlying storage system." -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` -type VolumeSnapshot struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // spec defines the desired characteristics of a snapshot requested by a user. - // More info: https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots - // Required. - Spec VolumeSnapshotSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - - // status represents the current information of a snapshot. - // NOTE: status can be modified by sources other than system controllers, - // and must not be depended upon for accuracy. - // Controllers should only use information from the VolumeSnapshotContent object - // after verifying that the binding is accurate and complete. - // +optional - Status *VolumeSnapshotStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// VolumeSnapshotList is a list of VolumeSnapshot objects -type VolumeSnapshotList struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // List of VolumeSnapshots - Items []VolumeSnapshot `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// VolumeSnapshotSpec describes the common attributes of a volume snapshot. -type VolumeSnapshotSpec struct { - // source specifies where a snapshot will be created from. - // This field is immutable after creation. - // Required. - Source VolumeSnapshotSource `json:"source" protobuf:"bytes,1,opt,name=source"` - - // volumeSnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot. - // If not specified, the default snapshot class will be used if one exists. - // If not specified, and there is no default snapshot class, dynamic snapshot creation will fail. - // Empty string is not allowed for this field. - // TODO(xiangqian): a webhook validation on empty string. - // More info: https://kubernetes.io/docs/concepts/storage/volume-snapshot-classes - // +optional - VolumeSnapshotClassName *string `json:"volumeSnapshotClassName,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotClassName"` -} - -// VolumeSnapshotSource specifies whether the underlying snapshot should be -// dynamically taken upon creation or if a pre-existing VolumeSnapshotContent -// object should be used. -// Exactly one of its members must be set. -// Members in VolumeSnapshotSource are immutable. -// TODO(xiangqian): Add a webhook to ensure that VolumeSnapshotSource members -// will not be updated once specified. -type VolumeSnapshotSource struct { - // persistentVolumeClaimName specifies the name of the PersistentVolumeClaim - // object in the same namespace as the VolumeSnapshot object where the - // snapshot should be dynamically taken from. - // This field is immutable. - // +optional - PersistentVolumeClaimName *string `json:"persistentVolumeClaimName,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeClaimName"` - - // volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent - // object. - // This field is immutable. - // +optional - VolumeSnapshotContentName *string `json:"volumeSnapshotContentName,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotContentName"` -} - -// VolumeSnapshotStatus is the status of the VolumeSnapshot -type VolumeSnapshotStatus struct { - // boundVolumeSnapshotContentName represents the name of the VolumeSnapshotContent - // object to which the VolumeSnapshot object is bound. - // If not specified, it indicates that the VolumeSnapshot object has not been - // successfully bound to a VolumeSnapshotContent object yet. - // NOTE: Specified boundVolumeSnapshotContentName alone does not mean binding - // is valid. Controllers MUST always verify bidirectional binding between - // VolumeSnapshot and VolumeSnapshotContent to avoid possible security issues. - // +optional - BoundVolumeSnapshotContentName *string `json:"boundVolumeSnapshotContentName,omitempty" protobuf:"bytes,1,opt,name=boundVolumeSnapshotContentName"` - - // creationTime is the timestamp when the point-in-time snapshot is taken - // by the underlying storage system. - // In dynamic snapshot creation case, this field will be filled in with the - // "creation_time" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "creation_time" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - // If not specified, it indicates that the creation time of the snapshot is unknown. - // +optional - CreationTime *metav1.Time `json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"` - - // readyToUse indicates if a snapshot is ready to be used to restore a volume. - // In dynamic snapshot creation case, this field will be filled in with the - // "ready_to_use" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "ready_to_use" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, - // otherwise, this field will be set to "True". - // If not specified, it means the readiness of a snapshot is unknown. - // +optional - ReadyToUse *bool `json:"readyToUse,omitempty" protobuf:"varint,3,opt,name=readyToUse"` - - // restoreSize represents the complete size of the snapshot in bytes. - // In dynamic snapshot creation case, this field will be filled in with the - // "size_bytes" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "size_bytes" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - // When restoring a volume from this snapshot, the size of the volume MUST NOT - // be smaller than the restoreSize if it is specified, otherwise the restoration will fail. - // If not specified, it indicates that the size is unknown. - // +optional - RestoreSize *resource.Quantity `json:"restoreSize,omitempty" protobuf:"bytes,4,opt,name=restoreSize"` - - // error is the last observed error during snapshot creation, if any. - // This field could be helpful to upper level controllers(i.e., application controller) - // to decide whether they should continue on waiting for the snapshot to be created - // based on the type of error reported. - // +optional - Error *VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,5,opt,name=error,casttype=VolumeSnapshotError"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VolumeSnapshotClass specifies parameters that a underlying storage system uses when -// creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its -// name in a VolumeSnapshot object. -// VolumeSnapshotClasses are non-namespaced -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=vsclass;vsclasses -// +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.driver` -// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.deletionPolicy`,description="Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted." -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` -type VolumeSnapshotClass struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // driver is the name of the storage driver that handles this VolumeSnapshotClass. - // Required. - Driver string `json:"driver" protobuf:"bytes,2,opt,name=driver"` - - // parameters is a key-value map with storage driver specific parameters for creating snapshots. - // These values are opaque to Kubernetes. - // +optional - Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"` - - // deletionPolicy determines whether a VolumeSnapshotContent created through - // the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. - // Supported values are "Retain" and "Delete". - // "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. - // "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. - // Required. - DeletionPolicy DeletionPolicy `json:"deletionPolicy" protobuf:"bytes,4,opt,name=deletionPolicy"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VolumeSnapshotClassList is a collection of VolumeSnapshotClasses. -// +kubebuilder:object:root=true -type VolumeSnapshotClassList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of VolumeSnapshotClasses - Items []VolumeSnapshotClass `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VolumeSnapshotContent represents the actual "on-disk" snapshot object in the -// underlying storage system -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=vsc;vscs -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="ReadyToUse",type=boolean,JSONPath=`.status.readyToUse`,description="Indicates if a snapshot is ready to be used to restore a volume." -// +kubebuilder:printcolumn:name="RestoreSize",type=integer,JSONPath=`.status.restoreSize`,description="Represents the complete size of the snapshot in bytes" -// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.spec.deletionPolicy`,description="Determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted." -// +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.spec.driver`,description="Name of the CSI driver used to create the physical snapshot on the underlying storage system." -// +kubebuilder:printcolumn:name="VolumeSnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="Name of the VolumeSnapshotClass to which this snapshot belongs." -// +kubebuilder:printcolumn:name="VolumeSnapshot",type=string,JSONPath=`.spec.volumeSnapshotRef.name`,description="Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound." -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` -type VolumeSnapshotContent struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // spec defines properties of a VolumeSnapshotContent created by the underlying storage system. - // Required. - Spec VolumeSnapshotContentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - - // status represents the current information of a snapshot. - // +optional - Status *VolumeSnapshotContentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VolumeSnapshotContentList is a list of VolumeSnapshotContent objects -// +kubebuilder:object:root=true -type VolumeSnapshotContentList struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of VolumeSnapshotContents - Items []VolumeSnapshotContent `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// VolumeSnapshotContentSpec is the specification of a VolumeSnapshotContent -type VolumeSnapshotContentSpec struct { - // volumeSnapshotRef specifies the VolumeSnapshot object to which this - // VolumeSnapshotContent object is bound. - // VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to - // this VolumeSnapshotContent's name for the bidirectional binding to be valid. - // For a pre-existing VolumeSnapshotContent object, name and namespace of the - // VolumeSnapshot object MUST be provided for binding to happen. - // This field is immutable after creation. - // Required. - VolumeSnapshotRef core_v1.ObjectReference `json:"volumeSnapshotRef" protobuf:"bytes,1,opt,name=volumeSnapshotRef"` - - // deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on - // the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. - // Supported values are "Retain" and "Delete". - // "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. - // "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. - // In dynamic snapshot creation case, this field will be filled in with the "DeletionPolicy" field defined in the - // VolumeSnapshotClass the VolumeSnapshot refers to. - // For pre-existing snapshots, users MUST specify this field when creating the VolumeSnapshotContent object. - // Required. - DeletionPolicy DeletionPolicy `json:"deletionPolicy" protobuf:"bytes,2,opt,name=deletionPolicy"` - - // driver is the name of the CSI driver used to create the physical snapshot on - // the underlying storage system. - // This MUST be the same as the name returned by the CSI GetPluginName() call for - // that driver. - // Required. - Driver string `json:"driver" protobuf:"bytes,3,opt,name=driver"` - - // name of the VolumeSnapshotClass to which this snapshot belongs. - // +optional - VolumeSnapshotClassName *string `json:"volumeSnapshotClassName,omitempty" protobuf:"bytes,4,opt,name=volumeSnapshotClassName"` - - // source specifies from where a snapshot will be created. - // This field is immutable after creation. - // Required. - Source VolumeSnapshotContentSource `json:"source" protobuf:"bytes,5,opt,name=source"` -} - -// VolumeSnapshotContentSource represents the CSI source of a snapshot. -// Exactly one of its members must be set. -// Members in VolumeSnapshotContentSource are immutable. -// TODO(xiangqian): Add a webhook to ensure that VolumeSnapshotContentSource members -// will be immutable once specified. -type VolumeSnapshotContentSource struct { - // volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot - // should be dynamically taken from. - // This field is immutable. - // +optional - VolumeHandle *string `json:"volumeHandle,omitempty" protobuf:"bytes,1,opt,name=volumeHandle"` - - // snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on - // the underlying storage system. - // This field is immutable. - // +optional - SnapshotHandle *string `json:"snapshotHandle,omitempty" protobuf:"bytes,2,opt,name=snapshotHandle"` -} - -// VolumeSnapshotContentStatus is the status of a VolumeSnapshotContent object -type VolumeSnapshotContentStatus struct { - // snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system. - // If not specified, it indicates that dynamic snapshot creation has either failed - // or it is still in progress. - // +optional - SnapshotHandle *string `json:"snapshotHandle,omitempty" protobuf:"bytes,1,opt,name=snapshotHandle"` - - // creationTime is the timestamp when the point-in-time snapshot is taken - // by the underlying storage system. - // In dynamic snapshot creation case, this field will be filled in with the - // "creation_time" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "creation_time" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - // If not specified, it indicates the creation time is unknown. - // 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. - // +optional - CreationTime *int64 `json:"creationTime,omitempty" protobuf:"varint,2,opt,name=creationTime"` - - // restoreSize represents the complete size of the snapshot in bytes. - // In dynamic snapshot creation case, this field will be filled in with the - // "size_bytes" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "size_bytes" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - // When restoring a volume from this snapshot, the size of the volume MUST NOT - // be smaller than the restoreSize if it is specified, otherwise the restoration will fail. - // If not specified, it indicates that the size is unknown. - // +kubebuilder:validation:Minimum=0 - // +optional - RestoreSize *int64 `json:"restoreSize,omitempty" protobuf:"bytes,3,opt,name=restoreSize"` - - // readyToUse indicates if a snapshot is ready to be used to restore a volume. - // In dynamic snapshot creation case, this field will be filled in with the - // "ready_to_use" value returned from CSI "CreateSnapshotRequest" gRPC call. - // For a pre-existing snapshot, this field will be filled with the "ready_to_use" - // value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, - // otherwise, this field will be set to "True". - // If not specified, it means the readiness of a snapshot is unknown. - // +optional. - ReadyToUse *bool `json:"readyToUse,omitempty" protobuf:"varint,4,opt,name=readyToUse"` - - // error is the latest observed error during snapshot creation, if any. - // +optional - Error *VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,5,opt,name=error,casttype=VolumeSnapshotError"` -} - -// DeletionPolicy describes a policy for end-of-life maintenance of volume snapshot contents -// +kubebuilder:validation:Enum=Delete;Retain -type DeletionPolicy string - -const ( - // volumeSnapshotContentDelete means the snapshot will be deleted from the - // underlying storage system on release from its volume snapshot. - VolumeSnapshotContentDelete DeletionPolicy = "Delete" - - // volumeSnapshotContentRetain means the snapshot will be left in its current - // state on release from its volume snapshot. - VolumeSnapshotContentRetain DeletionPolicy = "Retain" -) - -// VolumeSnapshotError describes an error encountered during snapshot creation. -type VolumeSnapshotError struct { - // time is the timestamp when the error was encountered. - // +optional - Time *metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"` - - // message is a string detailing the encountered error during snapshot - // creation if specified. - // NOTE: message may be logged, and it should not contain sensitive - // information. - // +optional - Message *string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"` -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/zz_generated.deepcopy.go deleted file mode 100644 index 5a0c66828..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,425 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1beta1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// 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 - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(VolumeSnapshotStatus) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshot. -func (in *VolumeSnapshot) DeepCopy() *VolumeSnapshot { - if in == nil { - return nil - } - out := new(VolumeSnapshot) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshot) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotClass) DeepCopyInto(out *VolumeSnapshotClass) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Parameters != nil { - in, out := &in.Parameters, &out.Parameters - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotClass. -func (in *VolumeSnapshotClass) DeepCopy() *VolumeSnapshotClass { - if in == nil { - return nil - } - out := new(VolumeSnapshotClass) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshotClass) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotClassList) DeepCopyInto(out *VolumeSnapshotClassList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VolumeSnapshotClass, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotClassList. -func (in *VolumeSnapshotClassList) DeepCopy() *VolumeSnapshotClassList { - if in == nil { - return nil - } - out := new(VolumeSnapshotClassList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshotClassList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotContent) DeepCopyInto(out *VolumeSnapshotContent) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(VolumeSnapshotContentStatus) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContent. -func (in *VolumeSnapshotContent) DeepCopy() *VolumeSnapshotContent { - if in == nil { - return nil - } - out := new(VolumeSnapshotContent) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshotContent) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotContentList) DeepCopyInto(out *VolumeSnapshotContentList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VolumeSnapshotContent, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentList. -func (in *VolumeSnapshotContentList) DeepCopy() *VolumeSnapshotContentList { - if in == nil { - return nil - } - out := new(VolumeSnapshotContentList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshotContentList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotContentSource) DeepCopyInto(out *VolumeSnapshotContentSource) { - *out = *in - if in.VolumeHandle != nil { - in, out := &in.VolumeHandle, &out.VolumeHandle - *out = new(string) - **out = **in - } - if in.SnapshotHandle != nil { - in, out := &in.SnapshotHandle, &out.SnapshotHandle - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentSource. -func (in *VolumeSnapshotContentSource) DeepCopy() *VolumeSnapshotContentSource { - if in == nil { - return nil - } - out := new(VolumeSnapshotContentSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotContentSpec) DeepCopyInto(out *VolumeSnapshotContentSpec) { - *out = *in - out.VolumeSnapshotRef = in.VolumeSnapshotRef - if in.VolumeSnapshotClassName != nil { - in, out := &in.VolumeSnapshotClassName, &out.VolumeSnapshotClassName - *out = new(string) - **out = **in - } - in.Source.DeepCopyInto(&out.Source) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentSpec. -func (in *VolumeSnapshotContentSpec) DeepCopy() *VolumeSnapshotContentSpec { - if in == nil { - return nil - } - out := new(VolumeSnapshotContentSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotContentStatus) DeepCopyInto(out *VolumeSnapshotContentStatus) { - *out = *in - if in.SnapshotHandle != nil { - in, out := &in.SnapshotHandle, &out.SnapshotHandle - *out = new(string) - **out = **in - } - if in.CreationTime != nil { - in, out := &in.CreationTime, &out.CreationTime - *out = new(int64) - **out = **in - } - if in.RestoreSize != nil { - in, out := &in.RestoreSize, &out.RestoreSize - *out = new(int64) - **out = **in - } - if in.ReadyToUse != nil { - in, out := &in.ReadyToUse, &out.ReadyToUse - *out = new(bool) - **out = **in - } - if in.Error != nil { - in, out := &in.Error, &out.Error - *out = new(VolumeSnapshotError) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentStatus. -func (in *VolumeSnapshotContentStatus) DeepCopy() *VolumeSnapshotContentStatus { - if in == nil { - return nil - } - out := new(VolumeSnapshotContentStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotError) DeepCopyInto(out *VolumeSnapshotError) { - *out = *in - if in.Time != nil { - in, out := &in.Time, &out.Time - *out = (*in).DeepCopy() - } - if in.Message != nil { - in, out := &in.Message, &out.Message - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotError. -func (in *VolumeSnapshotError) DeepCopy() *VolumeSnapshotError { - if in == nil { - return nil - } - out := new(VolumeSnapshotError) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotList) DeepCopyInto(out *VolumeSnapshotList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VolumeSnapshot, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotList. -func (in *VolumeSnapshotList) DeepCopy() *VolumeSnapshotList { - if in == nil { - return nil - } - out := new(VolumeSnapshotList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VolumeSnapshotList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotSource) DeepCopyInto(out *VolumeSnapshotSource) { - *out = *in - if in.PersistentVolumeClaimName != nil { - in, out := &in.PersistentVolumeClaimName, &out.PersistentVolumeClaimName - *out = new(string) - **out = **in - } - if in.VolumeSnapshotContentName != nil { - in, out := &in.VolumeSnapshotContentName, &out.VolumeSnapshotContentName - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotSource. -func (in *VolumeSnapshotSource) DeepCopy() *VolumeSnapshotSource { - if in == nil { - return nil - } - out := new(VolumeSnapshotSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotSpec) DeepCopyInto(out *VolumeSnapshotSpec) { - *out = *in - in.Source.DeepCopyInto(&out.Source) - if in.VolumeSnapshotClassName != nil { - in, out := &in.VolumeSnapshotClassName, &out.VolumeSnapshotClassName - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotSpec. -func (in *VolumeSnapshotSpec) DeepCopy() *VolumeSnapshotSpec { - if in == nil { - return nil - } - out := new(VolumeSnapshotSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSnapshotStatus) DeepCopyInto(out *VolumeSnapshotStatus) { - *out = *in - if in.BoundVolumeSnapshotContentName != nil { - in, out := &in.BoundVolumeSnapshotContentName, &out.BoundVolumeSnapshotContentName - *out = new(string) - **out = **in - } - if in.CreationTime != nil { - in, out := &in.CreationTime, &out.CreationTime - *out = (*in).DeepCopy() - } - if in.ReadyToUse != nil { - in, out := &in.ReadyToUse, &out.ReadyToUse - *out = new(bool) - **out = **in - } - if in.RestoreSize != nil { - in, out := &in.RestoreSize, &out.RestoreSize - x := (*in).DeepCopy() - *out = &x - } - if in.Error != nil { - in, out := &in.Error, &out.Error - *out = new(VolumeSnapshotError) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotStatus. -func (in *VolumeSnapshotStatus) DeepCopy() *VolumeSnapshotStatus { - if in == nil { - return nil - } - out := new(VolumeSnapshotStatus) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/clientset.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/clientset.go index 4c2a62c55..71d47a738 100644 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/clientset.go +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/clientset.go @@ -23,7 +23,6 @@ import ( "net/http" snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1" - snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -31,7 +30,6 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface SnapshotV1() snapshotv1.SnapshotV1Interface } @@ -39,13 +37,7 @@ type Interface interface { // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - snapshotV1beta1 *snapshotv1beta1.SnapshotV1beta1Client - snapshotV1 *snapshotv1.SnapshotV1Client -} - -// SnapshotV1beta1 retrieves the SnapshotV1beta1Client -func (c *Clientset) SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface { - return c.snapshotV1beta1 + snapshotV1 *snapshotv1.SnapshotV1Client } // SnapshotV1 retrieves the SnapshotV1Client @@ -93,10 +85,6 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error - cs.snapshotV1beta1, err = snapshotv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } cs.snapshotV1, err = snapshotv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -122,7 +110,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.snapshotV1beta1 = snapshotv1beta1.New(c) cs.snapshotV1 = snapshotv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/fake/clientset_generated.go index 918c625df..b3ab82a6e 100644 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/fake/clientset_generated.go +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/fake/clientset_generated.go @@ -22,8 +22,6 @@ import ( clientset "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned" snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1" fakesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1/fake" - snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1" - fakesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -81,11 +79,6 @@ var ( _ testing.FakeClient = &Clientset{} ) -// SnapshotV1beta1 retrieves the SnapshotV1beta1Client -func (c *Clientset) SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface { - return &fakesnapshotv1beta1.FakeSnapshotV1beta1{Fake: &c.Fake} -} - // SnapshotV1 retrieves the SnapshotV1Client func (c *Clientset) SnapshotV1() snapshotv1.SnapshotV1Interface { return &fakesnapshotv1.FakeSnapshotV1{Fake: &c.Fake} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/fake/register.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/fake/register.go index 305a7c75f..489359ce5 100644 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/fake/register.go +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/fake/register.go @@ -20,7 +20,6 @@ package fake import ( snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,7 +31,6 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - snapshotv1beta1.AddToScheme, snapshotv1.AddToScheme, } diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme/register.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme/register.go index 19669e47a..60f4addd4 100644 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme/register.go +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme/register.go @@ -20,7 +20,6 @@ package scheme import ( snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,7 +31,6 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - snapshotv1beta1.AddToScheme, snapshotv1.AddToScheme, } diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/doc.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/doc.go deleted file mode 100644 index 890a21e05..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1beta1 diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/doc.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/doc.go deleted file mode 100644 index dd9e9e4c8..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot.go deleted file mode 100644 index f2acab242..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVolumeSnapshots implements VolumeSnapshotInterface -type FakeVolumeSnapshots struct { - Fake *FakeSnapshotV1beta1 - ns string -} - -var volumesnapshotsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Resource: "volumesnapshots"} - -var volumesnapshotsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Kind: "VolumeSnapshot"} - -// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any. -func (c *FakeVolumeSnapshots) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshot, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(volumesnapshotsResource, c.ns, name), &v1beta1.VolumeSnapshot{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshot), err -} - -// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors. -func (c *FakeVolumeSnapshots) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(volumesnapshotsResource, volumesnapshotsKind, c.ns, opts), &v1beta1.VolumeSnapshotList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.VolumeSnapshotList{ListMeta: obj.(*v1beta1.VolumeSnapshotList).ListMeta} - for _, item := range obj.(*v1beta1.VolumeSnapshotList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshots. -func (c *FakeVolumeSnapshots) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(volumesnapshotsResource, c.ns, opts)) - -} - -// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. -func (c *FakeVolumeSnapshots) Create(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshot, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &v1beta1.VolumeSnapshot{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshot), err -} - -// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. -func (c *FakeVolumeSnapshots) Update(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshot, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &v1beta1.VolumeSnapshot{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshot), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVolumeSnapshots) UpdateStatus(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshot, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(volumesnapshotsResource, "status", c.ns, volumeSnapshot), &v1beta1.VolumeSnapshot{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshot), err -} - -// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs. -func (c *FakeVolumeSnapshots) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(volumesnapshotsResource, c.ns, name, opts), &v1beta1.VolumeSnapshot{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVolumeSnapshots) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(volumesnapshotsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1beta1.VolumeSnapshotList{}) - return err -} - -// Patch applies the patch and returns the patched volumeSnapshot. -func (c *FakeVolumeSnapshots) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshot, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(volumesnapshotsResource, c.ns, name, pt, data, subresources...), &v1beta1.VolumeSnapshot{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshot), err -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot_client.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot_client.go deleted file mode 100644 index 52f79b644..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshot_client.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeSnapshotV1beta1 struct { - *testing.Fake -} - -func (c *FakeSnapshotV1beta1) VolumeSnapshots(namespace string) v1beta1.VolumeSnapshotInterface { - return &FakeVolumeSnapshots{c, namespace} -} - -func (c *FakeSnapshotV1beta1) VolumeSnapshotClasses() v1beta1.VolumeSnapshotClassInterface { - return &FakeVolumeSnapshotClasses{c} -} - -func (c *FakeSnapshotV1beta1) VolumeSnapshotContents() v1beta1.VolumeSnapshotContentInterface { - return &FakeVolumeSnapshotContents{c} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeSnapshotV1beta1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotclass.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotclass.go deleted file mode 100644 index 97663878b..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotclass.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVolumeSnapshotClasses implements VolumeSnapshotClassInterface -type FakeVolumeSnapshotClasses struct { - Fake *FakeSnapshotV1beta1 -} - -var volumesnapshotclassesResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Resource: "volumesnapshotclasses"} - -var volumesnapshotclassesKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Kind: "VolumeSnapshotClass"} - -// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any. -func (c *FakeVolumeSnapshotClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(volumesnapshotclassesResource, name), &v1beta1.VolumeSnapshotClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotClass), err -} - -// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors. -func (c *FakeVolumeSnapshotClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotClassList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(volumesnapshotclassesResource, volumesnapshotclassesKind, opts), &v1beta1.VolumeSnapshotClassList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.VolumeSnapshotClassList{ListMeta: obj.(*v1beta1.VolumeSnapshotClassList).ListMeta} - for _, item := range obj.(*v1beta1.VolumeSnapshotClassList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshotClasses. -func (c *FakeVolumeSnapshotClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(volumesnapshotclassesResource, opts)) -} - -// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any. -func (c *FakeVolumeSnapshotClasses) Create(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(volumesnapshotclassesResource, volumeSnapshotClass), &v1beta1.VolumeSnapshotClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotClass), err -} - -// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any. -func (c *FakeVolumeSnapshotClasses) Update(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(volumesnapshotclassesResource, volumeSnapshotClass), &v1beta1.VolumeSnapshotClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotClass), err -} - -// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs. -func (c *FakeVolumeSnapshotClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(volumesnapshotclassesResource, name, opts), &v1beta1.VolumeSnapshotClass{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVolumeSnapshotClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(volumesnapshotclassesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1beta1.VolumeSnapshotClassList{}) - return err -} - -// Patch applies the patch and returns the patched volumeSnapshotClass. -func (c *FakeVolumeSnapshotClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotclassesResource, name, pt, data, subresources...), &v1beta1.VolumeSnapshotClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotClass), err -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotcontent.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotcontent.go deleted file mode 100644 index 50440b85b..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake/fake_volumesnapshotcontent.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVolumeSnapshotContents implements VolumeSnapshotContentInterface -type FakeVolumeSnapshotContents struct { - Fake *FakeSnapshotV1beta1 -} - -var volumesnapshotcontentsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Resource: "volumesnapshotcontents"} - -var volumesnapshotcontentsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1beta1", Kind: "VolumeSnapshotContent"} - -// Get takes name of the volumeSnapshotContent, and returns the corresponding volumeSnapshotContent object, and an error if there is any. -func (c *FakeVolumeSnapshotContents) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(volumesnapshotcontentsResource, name), &v1beta1.VolumeSnapshotContent{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotContent), err -} - -// List takes label and field selectors, and returns the list of VolumeSnapshotContents that match those selectors. -func (c *FakeVolumeSnapshotContents) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotContentList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(volumesnapshotcontentsResource, volumesnapshotcontentsKind, opts), &v1beta1.VolumeSnapshotContentList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.VolumeSnapshotContentList{ListMeta: obj.(*v1beta1.VolumeSnapshotContentList).ListMeta} - for _, item := range obj.(*v1beta1.VolumeSnapshotContentList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshotContents. -func (c *FakeVolumeSnapshotContents) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(volumesnapshotcontentsResource, opts)) -} - -// Create takes the representation of a volumeSnapshotContent and creates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any. -func (c *FakeVolumeSnapshotContents) Create(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(volumesnapshotcontentsResource, volumeSnapshotContent), &v1beta1.VolumeSnapshotContent{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotContent), err -} - -// Update takes the representation of a volumeSnapshotContent and updates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any. -func (c *FakeVolumeSnapshotContents) Update(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(volumesnapshotcontentsResource, volumeSnapshotContent), &v1beta1.VolumeSnapshotContent{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotContent), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVolumeSnapshotContents) UpdateStatus(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshotContent, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(volumesnapshotcontentsResource, "status", volumeSnapshotContent), &v1beta1.VolumeSnapshotContent{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotContent), err -} - -// Delete takes name of the volumeSnapshotContent and deletes it. Returns an error if one occurs. -func (c *FakeVolumeSnapshotContents) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(volumesnapshotcontentsResource, name, opts), &v1beta1.VolumeSnapshotContent{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVolumeSnapshotContents) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(volumesnapshotcontentsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1beta1.VolumeSnapshotContentList{}) - return err -} - -// Patch applies the patch and returns the patched volumeSnapshotContent. -func (c *FakeVolumeSnapshotContents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotContent, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotcontentsResource, name, pt, data, subresources...), &v1beta1.VolumeSnapshotContent{}) - if obj == nil { - return nil, err - } - return obj.(*v1beta1.VolumeSnapshotContent), err -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/generated_expansion.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/generated_expansion.go deleted file mode 100644 index 306b86f04..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/generated_expansion.go +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -type VolumeSnapshotExpansion interface{} - -type VolumeSnapshotClassExpansion interface{} - -type VolumeSnapshotContentExpansion interface{} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot.go deleted file mode 100644 index dfd5225c7..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - scheme "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VolumeSnapshotsGetter has a method to return a VolumeSnapshotInterface. -// A group's client should implement this interface. -type VolumeSnapshotsGetter interface { - VolumeSnapshots(namespace string) VolumeSnapshotInterface -} - -// VolumeSnapshotInterface has methods to work with VolumeSnapshot resources. -type VolumeSnapshotInterface interface { - Create(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.CreateOptions) (*v1beta1.VolumeSnapshot, error) - Update(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshot, error) - UpdateStatus(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshot, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.VolumeSnapshot, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.VolumeSnapshotList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshot, err error) - VolumeSnapshotExpansion -} - -// volumeSnapshots implements VolumeSnapshotInterface -type volumeSnapshots struct { - client rest.Interface - ns string -} - -// newVolumeSnapshots returns a VolumeSnapshots -func newVolumeSnapshots(c *SnapshotV1beta1Client, namespace string) *volumeSnapshots { - return &volumeSnapshots{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any. -func (c *volumeSnapshots) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshot, err error) { - result = &v1beta1.VolumeSnapshot{} - err = c.client.Get(). - Namespace(c.ns). - Resource("volumesnapshots"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors. -func (c *volumeSnapshots) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.VolumeSnapshotList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("volumesnapshots"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshots. -func (c *volumeSnapshots) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("volumesnapshots"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. -func (c *volumeSnapshots) Create(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshot, err error) { - result = &v1beta1.VolumeSnapshot{} - err = c.client.Post(). - Namespace(c.ns). - Resource("volumesnapshots"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshot). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. -func (c *volumeSnapshots) Update(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshot, err error) { - result = &v1beta1.VolumeSnapshot{} - err = c.client.Put(). - Namespace(c.ns). - Resource("volumesnapshots"). - Name(volumeSnapshot.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshot). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *volumeSnapshots) UpdateStatus(ctx context.Context, volumeSnapshot *v1beta1.VolumeSnapshot, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshot, err error) { - result = &v1beta1.VolumeSnapshot{} - err = c.client.Put(). - Namespace(c.ns). - Resource("volumesnapshots"). - Name(volumeSnapshot.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshot). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs. -func (c *volumeSnapshots) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("volumesnapshots"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *volumeSnapshots) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("volumesnapshots"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched volumeSnapshot. -func (c *volumeSnapshots) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshot, err error) { - result = &v1beta1.VolumeSnapshot{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("volumesnapshots"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot_client.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot_client.go deleted file mode 100644 index 1e50945d2..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot_client.go +++ /dev/null @@ -1,117 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "net/http" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type SnapshotV1beta1Interface interface { - RESTClient() rest.Interface - VolumeSnapshotsGetter - VolumeSnapshotClassesGetter - VolumeSnapshotContentsGetter -} - -// SnapshotV1beta1Client is used to interact with features provided by the snapshot.storage.k8s.io group. -type SnapshotV1beta1Client struct { - restClient rest.Interface -} - -func (c *SnapshotV1beta1Client) VolumeSnapshots(namespace string) VolumeSnapshotInterface { - return newVolumeSnapshots(c, namespace) -} - -func (c *SnapshotV1beta1Client) VolumeSnapshotClasses() VolumeSnapshotClassInterface { - return newVolumeSnapshotClasses(c) -} - -func (c *SnapshotV1beta1Client) VolumeSnapshotContents() VolumeSnapshotContentInterface { - return newVolumeSnapshotContents(c) -} - -// NewForConfig creates a new SnapshotV1beta1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*SnapshotV1beta1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new SnapshotV1beta1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SnapshotV1beta1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &SnapshotV1beta1Client{client}, nil -} - -// NewForConfigOrDie creates a new SnapshotV1beta1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *SnapshotV1beta1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new SnapshotV1beta1Client for the given RESTClient. -func New(c rest.Interface) *SnapshotV1beta1Client { - return &SnapshotV1beta1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *SnapshotV1beta1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotclass.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotclass.go deleted file mode 100644 index 289a82c3e..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotclass.go +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - scheme "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VolumeSnapshotClassesGetter has a method to return a VolumeSnapshotClassInterface. -// A group's client should implement this interface. -type VolumeSnapshotClassesGetter interface { - VolumeSnapshotClasses() VolumeSnapshotClassInterface -} - -// VolumeSnapshotClassInterface has methods to work with VolumeSnapshotClass resources. -type VolumeSnapshotClassInterface interface { - Create(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.CreateOptions) (*v1beta1.VolumeSnapshotClass, error) - Update(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshotClass, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.VolumeSnapshotClass, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.VolumeSnapshotClassList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotClass, err error) - VolumeSnapshotClassExpansion -} - -// volumeSnapshotClasses implements VolumeSnapshotClassInterface -type volumeSnapshotClasses struct { - client rest.Interface -} - -// newVolumeSnapshotClasses returns a VolumeSnapshotClasses -func newVolumeSnapshotClasses(c *SnapshotV1beta1Client) *volumeSnapshotClasses { - return &volumeSnapshotClasses{ - client: c.RESTClient(), - } -} - -// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any. -func (c *volumeSnapshotClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - result = &v1beta1.VolumeSnapshotClass{} - err = c.client.Get(). - Resource("volumesnapshotclasses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors. -func (c *volumeSnapshotClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotClassList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.VolumeSnapshotClassList{} - err = c.client.Get(). - Resource("volumesnapshotclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshotClasses. -func (c *volumeSnapshotClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("volumesnapshotclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any. -func (c *volumeSnapshotClasses) Create(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - result = &v1beta1.VolumeSnapshotClass{} - err = c.client.Post(). - Resource("volumesnapshotclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotClass). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any. -func (c *volumeSnapshotClasses) Update(ctx context.Context, volumeSnapshotClass *v1beta1.VolumeSnapshotClass, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshotClass, err error) { - result = &v1beta1.VolumeSnapshotClass{} - err = c.client.Put(). - Resource("volumesnapshotclasses"). - Name(volumeSnapshotClass.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotClass). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs. -func (c *volumeSnapshotClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("volumesnapshotclasses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *volumeSnapshotClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("volumesnapshotclasses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched volumeSnapshotClass. -func (c *volumeSnapshotClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotClass, err error) { - result = &v1beta1.VolumeSnapshotClass{} - err = c.client.Patch(pt). - Resource("volumesnapshotclasses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotcontent.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotcontent.go deleted file mode 100644 index 75767b0a4..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshotcontent.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - scheme "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VolumeSnapshotContentsGetter has a method to return a VolumeSnapshotContentInterface. -// A group's client should implement this interface. -type VolumeSnapshotContentsGetter interface { - VolumeSnapshotContents() VolumeSnapshotContentInterface -} - -// VolumeSnapshotContentInterface has methods to work with VolumeSnapshotContent resources. -type VolumeSnapshotContentInterface interface { - Create(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.CreateOptions) (*v1beta1.VolumeSnapshotContent, error) - Update(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshotContent, error) - UpdateStatus(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (*v1beta1.VolumeSnapshotContent, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.VolumeSnapshotContent, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.VolumeSnapshotContentList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotContent, err error) - VolumeSnapshotContentExpansion -} - -// volumeSnapshotContents implements VolumeSnapshotContentInterface -type volumeSnapshotContents struct { - client rest.Interface -} - -// newVolumeSnapshotContents returns a VolumeSnapshotContents -func newVolumeSnapshotContents(c *SnapshotV1beta1Client) *volumeSnapshotContents { - return &volumeSnapshotContents{ - client: c.RESTClient(), - } -} - -// Get takes name of the volumeSnapshotContent, and returns the corresponding volumeSnapshotContent object, and an error if there is any. -func (c *volumeSnapshotContents) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - result = &v1beta1.VolumeSnapshotContent{} - err = c.client.Get(). - Resource("volumesnapshotcontents"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VolumeSnapshotContents that match those selectors. -func (c *volumeSnapshotContents) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VolumeSnapshotContentList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.VolumeSnapshotContentList{} - err = c.client.Get(). - Resource("volumesnapshotcontents"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshotContents. -func (c *volumeSnapshotContents) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("volumesnapshotcontents"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a volumeSnapshotContent and creates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any. -func (c *volumeSnapshotContents) Create(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.CreateOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - result = &v1beta1.VolumeSnapshotContent{} - err = c.client.Post(). - Resource("volumesnapshotcontents"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotContent). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a volumeSnapshotContent and updates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any. -func (c *volumeSnapshotContents) Update(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - result = &v1beta1.VolumeSnapshotContent{} - err = c.client.Put(). - Resource("volumesnapshotcontents"). - Name(volumeSnapshotContent.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotContent). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *volumeSnapshotContents) UpdateStatus(ctx context.Context, volumeSnapshotContent *v1beta1.VolumeSnapshotContent, opts v1.UpdateOptions) (result *v1beta1.VolumeSnapshotContent, err error) { - result = &v1beta1.VolumeSnapshotContent{} - err = c.client.Put(). - Resource("volumesnapshotcontents"). - Name(volumeSnapshotContent.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotContent). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the volumeSnapshotContent and deletes it. Returns an error if one occurs. -func (c *volumeSnapshotContents) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("volumesnapshotcontents"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *volumeSnapshotContents) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("volumesnapshotcontents"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched volumeSnapshotContent. -func (c *volumeSnapshotContents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VolumeSnapshotContent, err error) { - result = &v1beta1.VolumeSnapshotContent{} - err = c.client.Patch(pt). - Resource("volumesnapshotcontents"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/generic.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/generic.go index 7dcd7dbd1..ecf05aecd 100644 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/generic.go +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/generic.go @@ -22,7 +22,6 @@ import ( "fmt" v1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -61,14 +60,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1.SchemeGroupVersion.WithResource("volumesnapshotcontents"): return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1().VolumeSnapshotContents().Informer()}, nil - // Group=snapshot.storage.k8s.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("volumesnapshots"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1beta1().VolumeSnapshots().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("volumesnapshotclasses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1beta1().VolumeSnapshotClasses().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("volumesnapshotcontents"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1beta1().VolumeSnapshotContents().Informer()}, nil - } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/interface.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/interface.go index b0bff475a..f71e5b12c 100644 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/interface.go +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/interface.go @@ -21,13 +21,10 @@ package volumesnapshot import ( internalinterfaces "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces" v1 "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1" - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1beta1 provides access to shared informers for resources in V1beta1. - V1beta1() v1beta1.Interface // V1 provides access to shared informers for resources in V1. V1() v1.Interface } @@ -43,11 +40,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1beta1 returns a new v1beta1.Interface. -func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) -} - // V1 returns a new v1.Interface. func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/interface.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/interface.go deleted file mode 100644 index 2440590d1..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/interface.go +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - internalinterfaces "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // VolumeSnapshots returns a VolumeSnapshotInformer. - VolumeSnapshots() VolumeSnapshotInformer - // VolumeSnapshotClasses returns a VolumeSnapshotClassInformer. - VolumeSnapshotClasses() VolumeSnapshotClassInformer - // VolumeSnapshotContents returns a VolumeSnapshotContentInformer. - VolumeSnapshotContents() VolumeSnapshotContentInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// VolumeSnapshots returns a VolumeSnapshotInformer. -func (v *version) VolumeSnapshots() VolumeSnapshotInformer { - return &volumeSnapshotInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// VolumeSnapshotClasses returns a VolumeSnapshotClassInformer. -func (v *version) VolumeSnapshotClasses() VolumeSnapshotClassInformer { - return &volumeSnapshotClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// VolumeSnapshotContents returns a VolumeSnapshotContentInformer. -func (v *version) VolumeSnapshotContents() VolumeSnapshotContentInformer { - return &volumeSnapshotContentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshot.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshot.go deleted file mode 100644 index 1ac8d3e0b..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshot.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - time "time" - - volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - versioned "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned" - internalinterfaces "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotInformer provides access to a shared informer and lister for -// VolumeSnapshots. -type VolumeSnapshotInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta1.VolumeSnapshotLister -} - -type volumeSnapshotInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVolumeSnapshotInformer constructs a new informer for VolumeSnapshot type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVolumeSnapshotInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVolumeSnapshotInformer constructs a new informer for VolumeSnapshot type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVolumeSnapshotInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshots(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshots(namespace).Watch(context.TODO(), options) - }, - }, - &volumesnapshotv1beta1.VolumeSnapshot{}, - resyncPeriod, - indexers, - ) -} - -func (f *volumeSnapshotInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *volumeSnapshotInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&volumesnapshotv1beta1.VolumeSnapshot{}, f.defaultInformer) -} - -func (f *volumeSnapshotInformer) Lister() v1beta1.VolumeSnapshotLister { - return v1beta1.NewVolumeSnapshotLister(f.Informer().GetIndexer()) -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotclass.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotclass.go deleted file mode 100644 index 955910254..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotclass.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - time "time" - - volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - versioned "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned" - internalinterfaces "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotClassInformer provides access to a shared informer and lister for -// VolumeSnapshotClasses. -type VolumeSnapshotClassInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta1.VolumeSnapshotClassLister -} - -type volumeSnapshotClassInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVolumeSnapshotClassInformer constructs a new informer for VolumeSnapshotClass type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVolumeSnapshotClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotClassInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVolumeSnapshotClassInformer constructs a new informer for VolumeSnapshotClass type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVolumeSnapshotClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshotClasses().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshotClasses().Watch(context.TODO(), options) - }, - }, - &volumesnapshotv1beta1.VolumeSnapshotClass{}, - resyncPeriod, - indexers, - ) -} - -func (f *volumeSnapshotClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *volumeSnapshotClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&volumesnapshotv1beta1.VolumeSnapshotClass{}, f.defaultInformer) -} - -func (f *volumeSnapshotClassInformer) Lister() v1beta1.VolumeSnapshotClassLister { - return v1beta1.NewVolumeSnapshotClassLister(f.Informer().GetIndexer()) -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotcontent.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotcontent.go deleted file mode 100644 index 88212df5f..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1/volumesnapshotcontent.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - time "time" - - volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - versioned "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned" - internalinterfaces "github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotContentInformer provides access to a shared informer and lister for -// VolumeSnapshotContents. -type VolumeSnapshotContentInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta1.VolumeSnapshotContentLister -} - -type volumeSnapshotContentInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVolumeSnapshotContentInformer constructs a new informer for VolumeSnapshotContent type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVolumeSnapshotContentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotContentInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVolumeSnapshotContentInformer constructs a new informer for VolumeSnapshotContent type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVolumeSnapshotContentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshotContents().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SnapshotV1beta1().VolumeSnapshotContents().Watch(context.TODO(), options) - }, - }, - &volumesnapshotv1beta1.VolumeSnapshotContent{}, - resyncPeriod, - indexers, - ) -} - -func (f *volumeSnapshotContentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotContentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *volumeSnapshotContentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&volumesnapshotv1beta1.VolumeSnapshotContent{}, f.defaultInformer) -} - -func (f *volumeSnapshotContentInformer) Lister() v1beta1.VolumeSnapshotContentLister { - return v1beta1.NewVolumeSnapshotContentLister(f.Informer().GetIndexer()) -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/expansion_generated.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/expansion_generated.go deleted file mode 100644 index e4ebdf84c..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/expansion_generated.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -// VolumeSnapshotListerExpansion allows custom methods to be added to -// VolumeSnapshotLister. -type VolumeSnapshotListerExpansion interface{} - -// VolumeSnapshotNamespaceListerExpansion allows custom methods to be added to -// VolumeSnapshotNamespaceLister. -type VolumeSnapshotNamespaceListerExpansion interface{} - -// VolumeSnapshotClassListerExpansion allows custom methods to be added to -// VolumeSnapshotClassLister. -type VolumeSnapshotClassListerExpansion interface{} - -// VolumeSnapshotContentListerExpansion allows custom methods to be added to -// VolumeSnapshotContentLister. -type VolumeSnapshotContentListerExpansion interface{} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshot.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshot.go deleted file mode 100644 index 70a8d5ba7..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshot.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotLister helps list VolumeSnapshots. -// All objects returned here must be treated as read-only. -type VolumeSnapshotLister interface { - // List lists all VolumeSnapshots in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error) - // VolumeSnapshots returns an object that can list and get VolumeSnapshots. - VolumeSnapshots(namespace string) VolumeSnapshotNamespaceLister - VolumeSnapshotListerExpansion -} - -// volumeSnapshotLister implements the VolumeSnapshotLister interface. -type volumeSnapshotLister struct { - indexer cache.Indexer -} - -// NewVolumeSnapshotLister returns a new VolumeSnapshotLister. -func NewVolumeSnapshotLister(indexer cache.Indexer) VolumeSnapshotLister { - return &volumeSnapshotLister{indexer: indexer} -} - -// List lists all VolumeSnapshots in the indexer. -func (s *volumeSnapshotLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VolumeSnapshot)) - }) - return ret, err -} - -// VolumeSnapshots returns an object that can list and get VolumeSnapshots. -func (s *volumeSnapshotLister) VolumeSnapshots(namespace string) VolumeSnapshotNamespaceLister { - return volumeSnapshotNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VolumeSnapshotNamespaceLister helps list and get VolumeSnapshots. -// All objects returned here must be treated as read-only. -type VolumeSnapshotNamespaceLister interface { - // List lists all VolumeSnapshots in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error) - // Get retrieves the VolumeSnapshot from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.VolumeSnapshot, error) - VolumeSnapshotNamespaceListerExpansion -} - -// volumeSnapshotNamespaceLister implements the VolumeSnapshotNamespaceLister -// interface. -type volumeSnapshotNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VolumeSnapshots in the indexer for a given namespace. -func (s volumeSnapshotNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VolumeSnapshot)) - }) - return ret, err -} - -// Get retrieves the VolumeSnapshot from the indexer for a given namespace and name. -func (s volumeSnapshotNamespaceLister) Get(name string) (*v1beta1.VolumeSnapshot, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("volumesnapshot"), name) - } - return obj.(*v1beta1.VolumeSnapshot), nil -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshotclass.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshotclass.go deleted file mode 100644 index 332b55314..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshotclass.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotClassLister helps list VolumeSnapshotClasses. -// All objects returned here must be treated as read-only. -type VolumeSnapshotClassLister interface { - // List lists all VolumeSnapshotClasses in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotClass, err error) - // Get retrieves the VolumeSnapshotClass from the index for a given name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.VolumeSnapshotClass, error) - VolumeSnapshotClassListerExpansion -} - -// volumeSnapshotClassLister implements the VolumeSnapshotClassLister interface. -type volumeSnapshotClassLister struct { - indexer cache.Indexer -} - -// NewVolumeSnapshotClassLister returns a new VolumeSnapshotClassLister. -func NewVolumeSnapshotClassLister(indexer cache.Indexer) VolumeSnapshotClassLister { - return &volumeSnapshotClassLister{indexer: indexer} -} - -// List lists all VolumeSnapshotClasses in the indexer. -func (s *volumeSnapshotClassLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotClass, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VolumeSnapshotClass)) - }) - return ret, err -} - -// Get retrieves the VolumeSnapshotClass from the index for a given name. -func (s *volumeSnapshotClassLister) Get(name string) (*v1beta1.VolumeSnapshotClass, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("volumesnapshotclass"), name) - } - return obj.(*v1beta1.VolumeSnapshotClass), nil -} diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshotcontent.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshotcontent.go deleted file mode 100644 index 036e3e7c1..000000000 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1/volumesnapshotcontent.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotContentLister helps list VolumeSnapshotContents. -// All objects returned here must be treated as read-only. -type VolumeSnapshotContentLister interface { - // List lists all VolumeSnapshotContents in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotContent, err error) - // Get retrieves the VolumeSnapshotContent from the index for a given name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.VolumeSnapshotContent, error) - VolumeSnapshotContentListerExpansion -} - -// volumeSnapshotContentLister implements the VolumeSnapshotContentLister interface. -type volumeSnapshotContentLister struct { - indexer cache.Indexer -} - -// NewVolumeSnapshotContentLister returns a new VolumeSnapshotContentLister. -func NewVolumeSnapshotContentLister(indexer cache.Indexer) VolumeSnapshotContentLister { - return &volumeSnapshotContentLister{indexer: indexer} -} - -// List lists all VolumeSnapshotContents in the indexer. -func (s *volumeSnapshotContentLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotContent, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VolumeSnapshotContent)) - }) - return ret, err -} - -// Get retrieves the VolumeSnapshotContent from the index for a given name. -func (s *volumeSnapshotContentLister) Get(name string) (*v1beta1.VolumeSnapshotContent, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("volumesnapshotcontent"), name) - } - return obj.(*v1beta1.VolumeSnapshotContent), nil -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 4eb6b3853..5c1177ade 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -82,21 +82,21 @@ github.com/kubernetes-csi/csi-test/v4/utils # github.com/kubernetes-csi/external-snapshotter/client/v6 v6.0.0 => ./client ## explicit; go 1.17 github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1 -github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1beta1 github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/fake github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/scheme github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1 github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1/fake -github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1 -github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1beta1/fake github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/internalinterfaces github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1 -github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1beta1 github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1 -github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1beta1 +# github.com/mailru/easyjson v0.7.6 +## explicit; go 1.12 +github.com/mailru/easyjson/buffer +github.com/mailru/easyjson/jlexer +github.com/mailru/easyjson/jwriter # github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 ## explicit; go 1.9 github.com/matttproud/golang_protobuf_extensions/pbutil From 69f7194e0a282ccae34ccb1ff1e8ddb2fff12021 Mon Sep 17 00:00:00 2001 From: Raunak Pradip Shah Date: Wed, 11 May 2022 12:19:43 +0530 Subject: [PATCH 3/4] Change storage to true --- .../crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml index 46ddb9d00..fe53fd3bf 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml @@ -76,7 +76,7 @@ spec: - driver type: object served: true - storage: false + storage: true subresources: {} status: acceptedNames: From 7f4ea70a6603ec4a99f06975290ae14fe62560ee Mon Sep 17 00:00:00 2001 From: Raunak Pradip Shah Date: Sat, 14 May 2022 11:13:55 +0530 Subject: [PATCH 4/4] Add back oneOf in volumesnapshotcontets.yaml --- .../crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml | 3 +++ .../config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml | 4 ++-- vendor/modules.txt | 5 ----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml index f636a5f82..30ee778f0 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml @@ -115,6 +115,9 @@ spec: This field is immutable. type: string type: object + oneOf: + - required: ["snapshotHandle"] + - required: ["volumeHandle"] sourceVolumeMode: description: SourceVolumeMode is the mode of the volume whose snapshot is taken. Can be either “Filesystem” or “Block”. If not specified, diff --git a/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml b/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml index fd9712c40..e98539c51 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml @@ -100,8 +100,8 @@ spec: type: string type: object oneOf: - - required: [ "persistentVolumeClaimName" ] - - required: [ "volumeSnapshotContentName" ] + - required: ["persistentVolumeClaimName"] + - required: ["volumeSnapshotContentName"] volumeSnapshotClassName: description: 'VolumeSnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot. VolumeSnapshotClassName may be diff --git a/vendor/modules.txt b/vendor/modules.txt index 5c1177ade..595a352a5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -92,11 +92,6 @@ github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversi github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/volumesnapshot/v1 github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1 -# github.com/mailru/easyjson v0.7.6 -## explicit; go 1.12 -github.com/mailru/easyjson/buffer -github.com/mailru/easyjson/jlexer -github.com/mailru/easyjson/jwriter # github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 ## explicit; go 1.9 github.com/matttproud/golang_protobuf_extensions/pbutil