nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: kubernetes-csi/external-provisioner
Pull request #699 (2022-01-26 19:26:39)

relax same storageclass restriction
**What type of PR is this?**
> /kind feature

**What this PR does / why we need it**:
The restriction that cloning is only supported within the same Storage Class, restricts PVC cloning in some cases. For example, if you want to clone from a zonal volume --> regional volume, the replication-type for these two volumes must be different, so they require different Storage Classes. Currently snapshot allows for restoring from a snapshot with a different StorageClass, and it leaves the validation up to the CSI Drivers. No validation is done in the external provisioner to make sure the Storage Classes are compatible. For PVC cloning, validation will also be up to the CSI Drivers.

**Which issue(s) this PR fixes**:
Fixes https://github.com/kubernetes-csi/docs/issues/490

**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->
```release-note
Users will be able to clone a volume with a different Storage Class. The destination volume no longer has to be the same storage class as the source. 
```


Patch:
diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go
index 94cb2d1dd..0ef116cc2 100644
--- a/pkg/controller/controller.go
+++ b/pkg/controller/controller.go
@@ -963,11 +963,6 @@ func (p *csiProvisioner) getPVCSource(ctx context.Context, claim *v1.PersistentV
 		return nil, fmt.Errorf("the requested PVC (%s) storageclass cannot be empty", claim.Name)
 	}
 
-	if *sourcePVC.Spec.StorageClassName != *claim.Spec.StorageClassName {
-		return nil, fmt.Errorf("the source PVC and destination PVCs must be in the same storage class for cloning.  Source is in %v, but new PVC is in %v",
-			*sourcePVC.Spec.StorageClassName, *claim.Spec.StorageClassName)
-	}
-
 	capacity := claim.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
 	requestedSize := capacity.Value()
 	srcCapacity := sourcePVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]


Test patch:
diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go
index f24297486..8230e9361 100644
--- a/pkg/controller/controller_test.go
+++ b/pkg/controller/controller_test.go
@@ -4148,9 +4148,10 @@ func TestProvisionFromPVC(t *testing.T) {
 			expectErr:        true,
 		},
 		"provision with pvc data source different storage classes": {
-			clonePVName: pvName,
-			volOpts:     generatePVCForProvisionFromPVC(srcNamespace, srcName, fakeSc2, requestedBytes, ""),
-			expectErr:   true,
+			clonePVName:      pvName,
+			volOpts:          generatePVCForProvisionFromPVC(srcNamespace, srcName, fakeSc2, requestedBytes, ""),
+			expectFinalizers: true,
+			expectErr:        false,
 		},
 		"provision with pvc data source destination too small": {
 			clonePVName:          pvName,
Repository: kubernetes-csi/external-provisioner
Pull request #701 (2022-02-03 12:08:31)

Validate OWNERS files
**What type of PR is this?**

For reference: https://github.com/kubernetes/community/issues/6334
/kind cleanup

**What this PR does / why we need it:**

**Which issue(s) this PR fixes:**

Fixes #

**Special notes for your reviewer:**

**Does this PR introduce a user-facing change?:**


Patch:
diff --git a/OWNERS b/OWNERS
index 8af8627f4..58e0a6d32 100644
--- a/OWNERS
+++ b/OWNERS
@@ -6,5 +6,5 @@ approvers:
 reviewers:
 - kubernetes-csi-reviewers
 
-emeritus_reviewers:
-- davidz627
+# emeritus_reviewers:
+# - davidz627
diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go
index 0ef116cc2..94cb2d1dd 100644
--- a/pkg/controller/controller.go
+++ b/pkg/controller/controller.go
@@ -963,6 +963,11 @@ func (p *csiProvisioner) getPVCSource(ctx context.Context, claim *v1.PersistentV
 		return nil, fmt.Errorf("the requested PVC (%s) storageclass cannot be empty", claim.Name)
 	}
 
+	if *sourcePVC.Spec.StorageClassName != *claim.Spec.StorageClassName {
+		return nil, fmt.Errorf("the source PVC and destination PVCs must be in the same storage class for cloning.  Source is in %v, but new PVC is in %v",
+			*sourcePVC.Spec.StorageClassName, *claim.Spec.StorageClassName)
+	}
+
 	capacity := claim.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
 	requestedSize := capacity.Value()
 	srcCapacity := sourcePVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]


Test patch:
diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go
index 8230e9361..f24297486 100644
--- a/pkg/controller/controller_test.go
+++ b/pkg/controller/controller_test.go
@@ -4148,10 +4148,9 @@ func TestProvisionFromPVC(t *testing.T) {
 			expectErr:        true,
 		},
 		"provision with pvc data source different storage classes": {
-			clonePVName:      pvName,
-			volOpts:          generatePVCForProvisionFromPVC(srcNamespace, srcName, fakeSc2, requestedBytes, ""),
-			expectFinalizers: true,
-			expectErr:        false,
+			clonePVName: pvName,
+			volOpts:     generatePVCForProvisionFromPVC(srcNamespace, srcName, fakeSc2, requestedBytes, ""),
+			expectErr:   true,
 		},
 		"provision with pvc data source destination too small": {
 			clonePVName:          pvName,