Repository: kubernetes-sigs/gcp-compute-persistent-disk-csi-driver
Pull request #1174 (2023-03-17 19:46:00)

[release-1.9] Revert PR#1090
This is an automated cherry-pick of #1173

/assign sunnylovestiramisu

```release-note
Revert [#1090](https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/pull/1090)
```


Patch:
diff --git a/pkg/common/parameters.go b/pkg/common/parameters.go
index 4137fe3d..422498b0 100644
--- a/pkg/common/parameters.go
+++ b/pkg/common/parameters.go
@@ -58,11 +58,6 @@ const (
 	tagKeyCreatedForSnapshotName        = "kubernetes.io/created-for/volumesnapshot/name"
 	tagKeyCreatedForSnapshotNamespace   = "kubernetes.io/created-for/volumesnapshot/namespace"
 	tagKeyCreatedForSnapshotContentName = "kubernetes.io/created-for/volumesnapshotcontent/name"
-
-	// Keys for labels to tag to PV
-	labelKeyCreatedForClaimNamespace = "kubernetes_io_created-for_pvc_namespace"
-	labelKeyCreatedForClaimName      = "kubernetes_io_created-for_pvc_name"
-	labelKeyCreatedForVolumeName     = "kubernetes_io_created-for_pv_name"
 )
 
 // DiskParameters contains normalized and defaulted disk parameters
@@ -135,13 +130,10 @@ func ExtractAndDefaultParameters(parameters map[string]string, driverName string
 			p.DiskEncryptionKMSKey = v
 		case ParameterKeyPVCName:
 			p.Tags[tagKeyCreatedForClaimName] = v
-			p.Labels[labelKeyCreatedForClaimName] = v
 		case ParameterKeyPVCNamespace:
 			p.Tags[tagKeyCreatedForClaimNamespace] = v
-			p.Labels[labelKeyCreatedForClaimNamespace] = v
 		case ParameterKeyPVName:
 			p.Tags[tagKeyCreatedForVolumeName] = v
-			p.Labels[labelKeyCreatedForVolumeName] = v
 		case ParameterKeyLabels:
 			paramLabels, err := ConvertLabelsStringToMap(v)
 			if err != nil {


Test patch:
diff --git a/pkg/common/parameters_test.go b/pkg/common/parameters_test.go
index eb402384..2d1a4b6b 100644
--- a/pkg/common/parameters_test.go
+++ b/pkg/common/parameters_test.go
@@ -139,7 +139,7 @@ func TestExtractAndDefaultParameters(t *testing.T) {
 				ReplicationType:      "none",
 				DiskEncryptionKMSKey: "",
 				Tags:                 map[string]string{tagKeyCreatedForClaimName: "testPVCName", tagKeyCreatedForClaimNamespace: "testPVCNamespace", tagKeyCreatedForVolumeName: "testPVName", tagKeyCreatedBy: "testDriver"},
-				Labels:               map[string]string{labelKeyCreatedForClaimName: "testPVCName", labelKeyCreatedForClaimNamespace: "testPVCNamespace", labelKeyCreatedForVolumeName: "testPVName"},
+				Labels:               map[string]string{},
 			},
 		},
 		{
@@ -178,30 +178,6 @@ func TestExtractAndDefaultParameters(t *testing.T) {
 				Labels:               map[string]string{"key1": "value1", "label-1": "value-a", "label-2": "label-value-2"},
 			},
 		},
-		{
-			name:       "PVC labels",
-			parameters: map[string]string{ParameterKeyPVCName: "testPVCName", ParameterKeyPVCNamespace: "testPVCNamespace", ParameterKeyPVName: "testPVName"},
-			labels:     map[string]string{},
-			expectParams: DiskParameters{
-				DiskType:             "pd-standard",
-				ReplicationType:      "none",
-				DiskEncryptionKMSKey: "",
-				Tags:                 map[string]string{tagKeyCreatedForClaimName: "testPVCName", tagKeyCreatedForClaimNamespace: "testPVCNamespace", tagKeyCreatedForVolumeName: "testPVName", tagKeyCreatedBy: "testDriver"},
-				Labels:               map[string]string{labelKeyCreatedForClaimName: "testPVCName", labelKeyCreatedForClaimNamespace: "testPVCNamespace", labelKeyCreatedForVolumeName: "testPVName"},
-			},
-		},
-		{
-			name:       "PVC labels-override",
-			parameters: map[string]string{ParameterKeyPVCName: "testPVCName", ParameterKeyPVCNamespace: "testPVCNamespace", ParameterKeyPVName: "testPVName"},
-			labels:     map[string]string{labelKeyCreatedForClaimNamespace: "test-override"},
-			expectParams: DiskParameters{
-				DiskType:             "pd-standard",
-				ReplicationType:      "none",
-				DiskEncryptionKMSKey: "",
-				Tags:                 map[string]string{tagKeyCreatedForClaimName: "testPVCName", tagKeyCreatedForClaimNamespace: "testPVCNamespace", tagKeyCreatedForVolumeName: "testPVName", tagKeyCreatedBy: "testDriver"},
-				Labels:               map[string]string{labelKeyCreatedForClaimName: "testPVCName", labelKeyCreatedForClaimNamespace: "testPVCNamespace", labelKeyCreatedForVolumeName: "testPVName"},
-			},
-		},
 	}
 
 	for _, tc := range tests {