Skip to content

Avoid errant warning in volume ID check#257

Open
dabradley wants to merge 1 commit intokubernetes-sigs:developmentfrom
dabradley:avoid-errant-warning
Open

Avoid errant warning in volume ID check#257
dabradley wants to merge 1 commit intokubernetes-sigs:developmentfrom
dabradley:avoid-errant-warning

Conversation

@dabradley
Copy link
Collaborator

What type of PR is this?

What this PR does / why we need it:
The conditional in this case was always logging an issue even when there wasn't one. This didn't cause behavior issues but did make reading the log output confusing. The PR also makes sure the tests for this code are correct and complete, though it's not feasible to test the logging directly.

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

Release note:

none

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 15, 2026
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 15, 2026
@k8s-ci-robot k8s-ci-robot requested a review from t-mialve January 15, 2026 17:43
@dabradley dabradley requested review from Copilot and removed request for andyzhangx January 15, 2026 17:47
@coveralls
Copy link

coveralls commented Jan 15, 2026

Pull Request Test Coverage Report for Build 21041225241

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.2%) to 87.86%

Files with Coverage Reduction New Missed Lines %
pkg/azurelustre/nodeserver.go 2 79.48%
Totals Coverage Status
Change from base Build 20998306893: 0.2%
Covered Lines: 1954
Relevant Lines: 2224

💛 - Coveralls

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the volume ID validation logic that was causing an errant warning to be logged even when the created-by-dynamic-provisioning parameter had a valid value of "t". The fix changes consecutive if statements to an if-else if structure, ensuring warnings are only logged for truly invalid values. The PR also enhances test coverage by adding comprehensive test cases for all valid and invalid values of this parameter.

Changes:

  • Fixed conditional logic in newLustreVolume to avoid false warnings when created-by-dynamic-provisioning is "t"
  • Updated test volume IDs to include the dynamic provisioning flag in the correct format
  • Added comprehensive test cases covering "t" (true), "f" (false), and invalid value scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/azurelustre/nodeserver.go Fixed the conditional logic to use else if instead of separate if statements, preventing errant warnings for valid "t" values
pkg/azurelustre/nodeserver_test.go Updated volume IDs to correct format and added three comprehensive test cases for dynamic provisioning flag handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

VolumeId: "vol_1#lustrefs#1.1.1.1##test-amlfilesystem-rg",
VolumeId: "vol_1#lustrefs#1.1.1.1##t#test-amlfilesystem-rg",
TargetPath: targetTest,
VolumeContext: map[string]string{"mgs-ip-address": "1.1.1.1", "fs-name": "lustrefs", "amlfilesystem-name": "test-amlfilesystem-name", "resource-group-name": "test-amlfilesystem-rg"},
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VolumeContext should include "created-by-dynamic-provisioning": "t" to match the volume ID. Currently, the volume ID indicates dynamic provisioning with the "t" flag, but the VolumeContext doesn't include this parameter. This will cause a warning to be logged at runtime: "volume context does not match values in volume ID for volumeID".

Suggested change
VolumeContext: map[string]string{"mgs-ip-address": "1.1.1.1", "fs-name": "lustrefs", "amlfilesystem-name": "test-amlfilesystem-name", "resource-group-name": "test-amlfilesystem-rg"},
VolumeContext: map[string]string{"mgs-ip-address": "1.1.1.1", "fs-name": "lustrefs", "amlfilesystem-name": "test-amlfilesystem-name", "resource-group-name": "test-amlfilesystem-rg", "created-by-dynamic-provisioning": "t"},

Copilot uses AI. Check for mistakes.
@dabradley dabradley force-pushed the avoid-errant-warning branch from ac02236 to 2765d43 Compare January 15, 2026 18:01
Copy link
Contributor

@jeffbearer jeffbearer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dabradley, jeffbearer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants