Skip to content

[cinder-csi-plugin] Rationalise all things topology #2865

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 5 commits into
base: master
Choose a base branch
from

Conversation

stephenfin
Copy link
Member

@stephenfin stephenfin commented Mar 24, 2025

What this PR does / why we need it:

This is a patch that came out of my work on #2861. Currently, generation of the topology request for the Cinder Volume is logically separated from the generation of the topology request for the CSI Volume. This makes things harder to understand. Move some things around to resolve this and make everything a little easier to grok. This is kept separate from #2862 since I don't expect we'll want to backport this.

Which issue this PR fixes(if applicable):

n/a

Special notes for reviewers:

I have a decoder of the logic embedded in the commit message. Hopefully this helps with review, but please don't assume the decoder itself is correct! 😅 I have also added additional unit tests that should capture any changes in logic.

Release note:

NONE

This is actually handled by csi-provisioner, but it's arguably
incorrect.

Signed-off-by: Stephen Finucane <[email protected]>
@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Mar 24, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kayrus for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 requested review from kayrus and zetaab March 24, 2025 18:13
@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 Mar 24, 2025
Calling '.On' with the same expected arguments multiple times will only
result in a single mock: the first one. We should avoid doing this.

We also remove some useless comments that simply duplicate what the
calls already say.

Signed-off-by: Stephen Finucane <[email protected]>
@stephenfin stephenfin force-pushed the cinder-topology-cleanup branch from a5d3216 to ae701b6 Compare March 25, 2025 14:34
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 25, 2025
@stephenfin stephenfin force-pushed the cinder-topology-cleanup branch from ae701b6 to 1ba7175 Compare March 25, 2025 14:38
Copy link
Contributor

@mdbooth mdbooth left a comment

Choose a reason for hiding this comment

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

Thanks for this series. Thanks also for splitting it into separate commits with excellent commit messages. That made it much easier to review.

I had some nits which you're welcome to ignore, but I think an issue in the fifth commit might be worth fixing.

I wonder if it's worth splitting the last commit, which actually changes the behaviour of --with-topology into a separate PR. Whether it's worth it might depend on the next point.

I also wonder if we need to guard this behaviour change somehow: has --with-topology been included in a release yet? If not I think we're good, but if it has I don't think we can make a breaking change like this without guardrails.

This highlights an issue (IMO) is how we handle parameter generation.

Signed-off-by: Stephen Finucane <[email protected]>
Group everything together rather than having it spread out as it is
currently. A decoder of the logic, to ensure nothing has changed:

1. Determine what the OpenStack Cinder volume's AZ will be:

  a. If the `availability` parameter is set on the Storage Class, the
     cinder volume will use this as the AZ.
  b. Otherwise, the cinder volume will use: an AZ extracted from one of
     the preferred CSI Topologies; an AZ extracted from one of the
     requisite (available) Topologies; or no AZ.

2. Determine what the Kubernetes CSI Volume's topology will be:

  a. If the `ignore-volume-az` option is set, the CSI Volume will use
     the preferred CSI Volume Topologies, if any, else None. [*]
  b. Otherwise, the CSI Volume will generate a Volume Topology from the
     Cinder Volume's AZ.

[*] This practically means that `ignore-volume-az` is only useful when
    the availability parameter is set on the Storage Class. This in turn
    means the CSI Volume Topology is junk as it has no bearing on the
    "real" topology constraint on the volume.

Signed-off-by: Stephen Finucane <[email protected]>
@stephenfin stephenfin force-pushed the cinder-topology-cleanup branch from 1ba7175 to 9bc4857 Compare April 3, 2025 17:10
@stephenfin
Copy link
Member Author

I wonder if it's worth splitting the last commit, which actually changes the behaviour of --with-topology into a separate PR. Whether it's worth it might depend on the next point.

I also wonder if we need to guard this behaviour change somehow: has --with-topology been included in a release yet? If not I think we're good, but if it has I don't think we can make a breaking change like this without guardrails.

Good point. I've dropped this. We would want a release note for the change.

Copy link
Contributor

@mdbooth mdbooth 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 k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants