Skip to content
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

[cinder-csi-plugin] ephemeral volume removal (#2602) #2640

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sergelogvinov
Copy link
Contributor

@sergelogvinov sergelogvinov commented Sep 3, 2024

What this PR does / why we need it:

Remove openstack credits from node plugin

Which issue this PR fixes(if applicable):

step 2 of #2599

Special notes for reviewers:

  1. Add cli flags (they have same purpose as [BlockStorage] params from cloud-config).
    It helps to avoid using the cloud-config on the nodes
  • search-order
  • rescan-on-resize
  • node-volume-attach-limit
# cinder-csi-plugin --help
...
      --node-volume-attach-limit int         The maximum number of volumes that can be attached to a node (default 256)
      --provide-controller-service           If set to true then the CSI driver does provide the controller service (default true)
      --provide-node-service                 If set to true then the CSI driver does provide the node service (default true)
      --rescan-on-resize                     If set to true then the CSI driver will rescan the device on volume resize
      --search-order string                  The search order for metadata service (default "configDrive,metadataService")

Release note:

If you override the default values for `rescan-on-resize` or `node-volume-attach-limit`, please switch to using CLI parameters in the DaemonSet pod arguments. Helm value path csi.plugin.extraArgs.

Manual tests:

  • create/delete
  • snapshot create/delete
  • create from clone

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Sep 3, 2024
@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 Kubernetes 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 added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 3, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @sergelogvinov. 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 the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 3, 2024
@sergelogvinov sergelogvinov force-pushed the no-ephemeral-2 branch 6 times, most recently from 5c01745 to 1912d64 Compare September 4, 2024 13:18
@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 Sep 4, 2024
@sergelogvinov sergelogvinov marked this pull request as ready for review September 4, 2024 14:10
@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 Sep 4, 2024
@sergelogvinov
Copy link
Contributor Author

When you have a time, can you take a look on this changes @jichenjc @dulek

I think it's ready to go, but we need to wait for the official release first.
Thanks.

@zetaab
Copy link
Member

zetaab commented Sep 4, 2024

/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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 4, 2024
@kayrus
Copy link
Contributor

kayrus commented Sep 11, 2024

@sergelogvinov could you please rebase your PR?

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 11, 2024
@sergelogvinov
Copy link
Contributor Author

@kayrus done.

Thank you!

@sergelogvinov
Copy link
Contributor Author

/test pull-cloud-provider-openstack-check

1 similar comment
@jichenjc
Copy link
Contributor

/test pull-cloud-provider-openstack-check

@sergelogvinov sergelogvinov force-pushed the no-ephemeral-2 branch 4 times, most recently from b9de18d to f154edb Compare September 12, 2024 11:29
@sergelogvinov
Copy link
Contributor Author

I've changed the golangci-lint version to 1.61.0, and test pull-cloud-provider-openstack-check passed.

@kayrus
Copy link
Contributor

kayrus commented Sep 17, 2024

@sergelogvinov I submitted a more agnostic PR that allows to run node service without credentials: #2655

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 17, 2024
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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 removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 18, 2024
@sergelogvinov sergelogvinov force-pushed the no-ephemeral-2 branch 2 times, most recently from f3ca7fd to 8a2fa6c Compare September 20, 2024 07:49
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 20, 2024

d.SetupNodeService(clouds[cloudNames[0]], mount, metadata, additionalTopologies)
d.SetupNodeService(mount, metadata, rescanOnResize, nodeVolumeAttachLimit, additionalTopologies)
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to pass a struct instead of a number of vars. https://refactoring.guru/smells/long-parameter-list

Copy link
Contributor Author

Choose a reason for hiding this comment

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

switch to openstack.BlockStorageOpts{}

//Initialize mount
mount := mount.GetMountProvider()

//Backward compatibility, read [BlockStorage] parameters from cloud config
cfg, err := openstack.GetConfigFromFiles(cloudConfig)
if err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This pattern is a bit uncommon. I'd rather check for err != nil and handle an error.

@@ -32,6 +32,12 @@ import (
const (
driverName = "cinder.csi.openstack.org"
topologyKey = "topology." + driverName + "/zone"

// MaxVolumesPerNode is the maximum number of volumes that can be attached to a node
MaxVolumesPerNode = 256
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does this const come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was hardcoded here

const defaultMaxVolAttachLimit int64 = 256

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to configure this value. OpenStack supports different hypervisors and each supports a different amount of attached volumes.

Copy link
Contributor

Choose a reason for hiding this comment

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

just in case, if the const/var doesn't need to be accessed from a different package, it's better to define its name starting with a lower case (non-exported). https://go.dev/tour/basics/3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, --node-volume-attach-limit flag customize it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

MaxVolumesPerNode -> maxVolumesPerNode 👍

Remove openstack credits from node plugin

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
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. 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants