Repository: kubernetes-sigs/gcp-filestore-csi-driver
Pull request #240 (2022-03-23 23:00:46)

fix inconsistency in definition of paramMultishareInstanceScLabel
<!--  Thanks for sending a pull request!  Here are some tips for you:

1. If this is your first time, please read our contributor guidelines: https://git.k8s.io/community/contributors/guide#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/guide/release-notes.md
3. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->

**What type of PR is this?**
 /kind bug


**What this PR does / why we need it**:
there are conflicting const of `paramMultishareInstanceScLabel` and `util. ParamMultishareInstanceScLabel` having different values, specifically the latter has incorrect definition

**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #

**Special notes for your reviewer**:

**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
NONE
```


k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/gcp-filestore-csi-driver/pull/240#" title="Author self-approved">leiyiz</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fgcp-filestore-csi-driver).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/gcp-filestore-csi-driver/blob/master/OWNERS)~~ [leiyiz]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
k8s-ci-robot: @leiyiz: The following test **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-gcp-filestore-csi-driver-unit | 44595a6f23a1ca31bdfa85142db48d98f1937daf | [link](https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/sigs.k8s.io_gcp-filestore-csi-driver/240/pull-gcp-filestore-csi-driver-unit/1506768202498052096/) | true | `/test pull-gcp-filestore-csi-driver-unit`

[Full PR test history](https://prow.k8s.io/pr-history?org=kubernetes-sigs&repo=gcp-filestore-csi-driver&pr=240). [Your PR dashboard](https://prow.k8s.io/pr?query=is%3Apr%20state%3Aopen%20author%3Aleiyiz). Please help us cut down on flakes by [linking to](https://git.k8s.io/community/contributors/devel/sig-testing/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/kubernetes-sigs/gcp-filestore-csi-driver/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
k8s-ci-robot: @leiyiz: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-gcp-filestore-csi-driver-unit | 44595a6f23a1ca31bdfa85142db48d98f1937daf | [link](https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/sigs.k8s.io_gcp-filestore-csi-driver/240/pull-gcp-filestore-csi-driver-unit/1506768202498052096/) | true | `/test pull-gcp-filestore-csi-driver-unit`
pull-gcp-filestore-csi-driver-verify | 44595a6f23a1ca31bdfa85142db48d98f1937daf | [link](https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/sigs.k8s.io_gcp-filestore-csi-driver/240/pull-gcp-filestore-csi-driver-verify/1506768202535800832/) | true | `/test pull-gcp-filestore-csi-driver-verify`

[Full PR test history](https://prow.k8s.io/pr-history?org=kubernetes-sigs&repo=gcp-filestore-csi-driver&pr=240). [Your PR dashboard](https://prow.k8s.io/pr?query=is%3Apr%20state%3Aopen%20author%3Aleiyiz). Please help us cut down on flakes by [linking to](https://git.k8s.io/community/contributors/devel/sig-testing/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/kubernetes-sigs/gcp-filestore-csi-driver/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
saikat-royc: the change is LGTM. ut needs to be fixed.

Patch:
diff --git a/pkg/csi_driver/multishare_controller.go b/pkg/csi_driver/multishare_controller.go
index b076a757..dcaaedc8 100644
--- a/pkg/csi_driver/multishare_controller.go
+++ b/pkg/csi_driver/multishare_controller.go
@@ -239,7 +239,7 @@ func (m *MultishareController) generateNewMultishareInstance(instanceName string
 		// ignore IPRange flag as it will be handled at the same place as cidr
 		case paramReservedIPV4CIDR, paramReservedIPRange:
 			continue
-		case strings.ToLower(util.ParamMultishareInstanceScLabel):
+		case paramMultishareInstanceScLabel:
 			continue
 		case ParameterKeyLabels, ParameterKeyPVCName, ParameterKeyPVCNamespace, ParameterKeyPVName:
 		case "csiprovisionersecretname", "csiprovisionersecretnamespace":
@@ -320,7 +320,7 @@ func extractInstanceLabels(parameters map[string]string, driverName string) (map
 			if err != nil {
 				return nil, status.Error(codes.InvalidArgument, err.Error())
 			}
-		case strings.ToLower(util.ParamMultishareInstanceScLabel):
+		case paramMultishareInstanceScLabel:
 			err := util.CheckLabelValueRegex(v)
 			if err != nil {
 				return nil, status.Error(codes.InvalidArgument, err.Error())
diff --git a/pkg/util/multishare_defs.go b/pkg/util/multishare_defs.go
index eb865f71..8a33919c 100644
--- a/pkg/util/multishare_defs.go
+++ b/pkg/util/multishare_defs.go
@@ -28,7 +28,6 @@ const (
 	MinShareSizeBytes                 int64 = 100 * Gb
 	MaxSharesPerInstance                    = 10
 	NewMultishareInstancePrefix             = "fs-"
-	ParamMultishareInstanceScLabel          = "instanceStorageClassLabel"
 	ParamMultishareInstanceScLabelKey       = "storage_gke_io_storage-class-id"
 )
 


Test patch:
diff --git a/pkg/csi_driver/multishare_controller_test.go b/pkg/csi_driver/multishare_controller_test.go
index fdd52663..7d49527a 100644
--- a/pkg/csi_driver/multishare_controller_test.go
+++ b/pkg/csi_driver/multishare_controller_test.go
@@ -305,8 +305,8 @@ func TestExtractInstanceLabels(t *testing.T) {
 			name:   "user labels",
 			driver: testDriverName,
 			params: map[string]string{
-				ParameterKeyLabels:                  "a=b,c=d",
-				util.ParamMultishareInstanceScLabel: "testsc",
+				ParameterKeyLabels:             "a=b,c=d",
+				paramMultishareInstanceScLabel: "testsc",
 			},
 			expectedLabel: map[string]string{
 				tagKeyCreatedBy:                        testDrivernameLabelValue,
@@ -353,18 +353,18 @@ func TestExtractShareLabels(t *testing.T) {
 		{
 			name: "user labels ignored",
 			params: map[string]string{
-				ParameterKeyLabels:                  "a=b,c=d",
-				util.ParamMultishareInstanceScLabel: "testsc",
+				ParameterKeyLabels:             "a=b,c=d",
+				paramMultishareInstanceScLabel: "testsc",
 			},
 		},
 		{
 			name: "driver labels",
 			params: map[string]string{
-				ParameterKeyLabels:                  "a=b,c=d",
-				util.ParamMultishareInstanceScLabel: "testsc",
-				ParameterKeyPVCName:                 testPVCName,
-				ParameterKeyPVCNamespace:            testPVCNamespace,
-				ParameterKeyPVName:                  testPVName,
+				ParameterKeyLabels:             "a=b,c=d",
+				paramMultishareInstanceScLabel: "testsc",
+				ParameterKeyPVCName:            testPVCName,
+				ParameterKeyPVCNamespace:       testPVCNamespace,
+				ParameterKeyPVName:             testPVName,
 			},
 			expectedLabel: map[string]string{
 				tagKeyCreatedForClaimName:      testPVCName,
@@ -425,9 +425,9 @@ func TestGenerateNewMultishareInstance(t *testing.T) {
 			instanceName: testInstanceName,
 			req: &csi.CreateVolumeRequest{
 				Parameters: map[string]string{
-					paramConnectMode:                    directPeering,
-					ParameterKeyLabels:                  "a=b,c=d",
-					util.ParamMultishareInstanceScLabel: testInstanceScPrefix,
+					paramConnectMode:               directPeering,
+					ParameterKeyLabels:             "a=b,c=d",
+					paramMultishareInstanceScLabel: testInstanceScPrefix,
 				},
 			},
 			expectedInstance: &file.MultishareInstance{