-
Notifications
You must be signed in to change notification settings - Fork 635
[manila-csi-plugin] Add support for authentication via clouds.yaml #2883
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
base: master
Are you sure you want to change the base?
[manila-csi-plugin] Add support for authentication via clouds.yaml #2883
Conversation
Welcome @dkokkino! |
Hi @dkokkino. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small nits, but this looks pretty good to me. You can likely change this to ready-for-review now. I would suggest filing a bug describing the three issues you're fixing here and adding a release note indicating that we now support configuration from a clouds.yaml
file for the Manila CSI driver.
// Handle boolean fields | ||
if field.Kind() == reflect.Bool { | ||
boolValue, err := strconv.ParseBool(value) | ||
if err != nil { | ||
return fmt.Errorf("invalid boolean value for parameter '%s': %v", fName, err) | ||
} | ||
field.SetBool(boolValue) | ||
continue | ||
} | ||
|
||
// Handle string fields | ||
if field.Kind() == reflect.String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use a switch statement here? Also, do we want an error case for other values? I suspect it'll be mostly dead code unless we extend the AuthOpts
struct but it's no harm (you should test what happens if you try to convert something with EndpointType
set, since that's of type gophercloud.Availability
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay i'll make the change to a switch case and add the error case for other values
I also tested setting a field of type gophercloud.Availability
(like EndpointType), and confirmed that assigning a string
value via reflection works as expected without special handling. Since Availability
is just a named string
type, reflect.SetString()
handles it correctly. I'll include that test.
Previously, the validator failed when attempting to parse boolean fields like `UseClouds` in `AuthOpts` from secrets. This was due to secrets being stored as strings, leading to a type mismatch. Added logic to correctly parse string representations of booleans to match the expected type in the struct.
Enables reading credentials/config from clouds.yaml when UseClouds is set. Mark Region and AuthURL as optional.
6a6bc5d
to
1d66e56
Compare
/lgtm thank you @dkokkino |
/ok-to-test |
@dkokkino: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
As I've noted elsewhere, failures in CI are due to the removal of |
Thanks for the rework here. /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: stephenfin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
AuthOps
andRegion
were incorrectly required when usingclouds.yaml
for authentication.clouds.yaml
Which issue this PR fixes(if applicable):
fixes #2886
Special notes for reviewers:
Release note: