Skip to content

Revert PR#1090 #1173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions pkg/common/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
26 changes: 1 addition & 25 deletions pkg/common/parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
},
},
{
Expand Down Expand Up @@ -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 {
Expand Down