Skip to content

[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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dkokkino
Copy link

@dkokkino dkokkino commented Apr 29, 2025

What this PR does / why we need it:

  1. Fixes a bug where AuthOps and Region were incorrectly required when using clouds.yaml for authentication.
  2. Resolves an issue where the validator could not properly handle boolean values retrieved from secrets.
  3. Adds a new test case to cover the boolean validation fix.
  4. Introduces support for authenticating the Manila CSI driver via clouds.yaml

Which issue this PR fixes(if applicable):
fixes #2886

Special notes for reviewers:

Release note:

Now support configuration from a clouds.yaml file for the Manila CSI driver.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. labels Apr 29, 2025
@k8s-ci-robot k8s-ci-robot requested review from gman0 and kayrus April 29, 2025 15:59
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 29, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @dkokkino!

It looks like this is your first PR to kubernetes/cloud-provider-openstack 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/cloud-provider-openstack has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 29, 2025
Copy link
Member

@stephenfin stephenfin left a 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.

Comment on lines 119 to 130
// 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 {
Copy link
Member

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).

Copy link
Author

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.

@dkokkino dkokkino changed the title [manila-csi-plugin] Rework authentication [manila-csi-plugin] Add support for authentication via clouds.yaml May 7, 2025
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels May 7, 2025
dkokkino added 2 commits May 7, 2025 13:26
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.
@dkokkino dkokkino force-pushed the rework-authentication-manila-csi-driver-operator branch from 6a6bc5d to 1d66e56 Compare May 7, 2025 11:27
@dkokkino dkokkino marked this pull request as ready for review May 7, 2025 11:30
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 7, 2025
@gouthampacha
Copy link
Contributor

/lgtm

thank you @dkokkino

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 7, 2025
@stephenfin
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 8, 2025
@k8s-ci-robot
Copy link
Contributor

@dkokkino: 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
openstack-cloud-csi-manila-e2e-test 1d66e56 link true /test openstack-cloud-csi-manila-e2e-test

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.

@stephenfin
Copy link
Member

As I've noted elsewhere, failures in CI are due to the removal of stable/2023.2 branch. We need #2742 or a similar PR to address this.

@stephenfin
Copy link
Member

Thanks for the rework here.

/lgtm
/approve
/hold while we fix CI

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 14, 2025
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 14, 2025
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Fix authentication issue via clouds.yaml in Manila CSI driver
4 participants