Skip to content

Changes to beforeserve to pick up storage array labels and parameters if provided#486

Merged
anathoodell merged 10 commits into
mainfrom
usr/anathoodell/multiaz-beforeserve2
Mar 13, 2025
Merged

Changes to beforeserve to pick up storage array labels and parameters if provided#486
anathoodell merged 10 commits into
mainfrom
usr/anathoodell/multiaz-beforeserve2

Conversation

@anathoodell

@anathoodell anathoodell commented Mar 11, 2025

Copy link
Copy Markdown
Contributor

Description

Changes to beforeServe in the driver container to allow for NodeGetInfo and CreateVolume (as necessary) to pick up StorageArrays Labels and Parameters if provided within the new powermax secret.

GitHub Issues

GitHub Issue #
https://github.com/dell/csm/issues/1748

Checklist:

  • Have you run format,vet & lint checks against your submission?
  • Have you made sure that the code compiles?
  • Did you run the unit & integration tests successfully?
  • Have you maintained at least 90% code coverage?
  • Have you commented your code, particularly in hard-to-understand areas
  • Have you done corresponding changes to the documentation
  • Did you run tests in a real Kubernetes cluster?
  • Backward compatibility is not broken

How Has This Been Tested?

pmax on k8s cluster.

and CreateVolume (as necessary) to pick up StorageArrays Labels and
Parameters if provided within the new powermax secret.

@donatwork donatwork left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add unit tests to cover all of the cases, especially where no labels nor parameters are present.

Comment thread service/service.go Outdated
Comment thread service/service.go Outdated
Comment thread service/service.go Outdated
getStorageArrays() func created and moved the code out of beforeServe.
@anathoodell anathoodell requested a review from donatwork March 12, 2025 21:23

@donatwork donatwork left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add unit tests.

Comment thread service/service.go Outdated
Comment thread service/service.go Outdated
Comment thread service/service.go
}

// StorageArrayConfig represents the configuration of a storage array in the config file
type StorageArrayConfig struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know it may seem redundant but adding the arrayID is a good way to double check the structure. Data structures should be independent of the container used to store it. Without the arrayID it cannot stand on its own.

Comment thread service/service.go
}

opts.StorageArrays = make(map[string]StorageArrayConfig)
GetStorageArrays(secretParams, &opts)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not that you need to change this but given that GetStorageArrays is a function and not a method you should not pass in the entire structure if GetStorageArrays is only modifying one part of the structure. Passing in the address of StorageArrays is safer and you pass in only what the function needs. So you could have coded as:

Suggested change
GetStorageArrays(secretParams, &opts)
opts.StorageArrays = GetStorageArrays(secretParams)

In this way you simplify the code and reduce the amount of data that the function can modify.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don's comment makes sense. Please see if you update it to

opts.StorageArrays = GetStorageArrays(secretParams)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will update in next PR.

@github-actions

Copy link
Copy Markdown
Contributor

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/dell/csi-powermax/service 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/dell/csi-powermax/service/service.go 0.00% (ø) 0 0 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/dell/csi-powermax/service/service_test.go

@anathoodell anathoodell requested a review from alexemc March 13, 2025 16:52
@santhoshatdell

Copy link
Copy Markdown
Contributor

@anathoodell Please add a GitHub issue.

@anathoodell

Copy link
Copy Markdown
Contributor Author
NAME                                   READY   STATUS    RESTARTS      AGE
powermax-controller-6899bbdb66-wxxt5   6/6     Running   8 (12m ago)   12m
powermax-node-72cw5                    2/2     Running   2 (11m ago)   12m
powermax-node-ds5nb                    2/2     Running   1 (11m ago)   12m

Comment thread service/service.go
PodmonPort string // to indicates the port to be used for exposing podmon API health
PodmonPollingFreq string // indicates the polling frequency to check array connectivity
TLSCertDir string
StorageArrays map[string]StorageArrayConfig

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is not a full detail of storage arrays. Can we name it differently?

Comment thread service/service.go
}

opts.StorageArrays = make(map[string]StorageArrayConfig)
GetStorageArrays(secretParams, &opts)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don's comment makes sense. Please see if you update it to

opts.StorageArrays = GetStorageArrays(secretParams)

@anathoodell anathoodell merged commit 07da4ac into main Mar 13, 2025
@anathoodell anathoodell deleted the usr/anathoodell/multiaz-beforeserve2 branch March 13, 2025 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants