Skip to content

Add --node-deployment flag for distributed resizing#573

Open
mnencia wants to merge 1 commit intokubernetes-csi:masterfrom
mnencia:dev/142
Open

Add --node-deployment flag for distributed resizing#573
mnencia wants to merge 1 commit intokubernetes-csi:masterfrom
mnencia:dev/142

Conversation

@mnencia
Copy link
Copy Markdown

@mnencia mnencia commented Apr 11, 2026

What type of PR is this?

/kind feature

What this PR does / why we need it:

For CSI drivers deployed as DaemonSets managing node-local volumes, there is no central controller pod where a centralized external-resizer can run. The provisioner and snapshotter sidecars already support --node-deployment for this deployment model.

This adds the same capability to the external-resizer. When enabled, each instance only processes resize requests for PVs whose nodeAffinity matches the local node. The flag requires NODE_NAME env var and is mutually exclusive with --leader-election.

The filtering is applied in the controller (pvNeedResize and pvCanBeExpanded), covering both Resizer implementations without changes to the Resizer interface.

Which issue(s) this PR fixes:

Fixes #142

Special notes for your reviewer:

This is a fresh implementation building on the prior work by @travisghansen in #195 (closed by triage bot), with two key differences:

  1. Filtering location: applied in the controller rather than in CanSupport, so it covers both the csiResizer and trivialResizer code paths.
  2. Filtering mechanism: uses PV nodeAffinity instead of the PVC volume.kubernetes.io/selected-node annotation, which is cleared by the provisioner after binding and would not be available at resize time.

The pvBelongsToNode helper checks MatchExpressions with NodeSelectorOpIn operator, which is what CSI provisioners use when translating AccessibleTopology segments into PV node affinity. Other operators (NotIn, Exists, etc.) and MatchFields are intentionally not handled, as they are not used by CSI drivers for node-local topology.

The modify controller (VolumeAttributesClass) is not covered by node filtering in this PR. Node-local CSI drivers typically do not use VolumeAttributesClass, so this is not blocking for the primary use case and can be addressed in a follow-up.

See also kubernetes-csi/csi-driver-host-path#651 for the downstream consumer of this feature.

Does this PR introduce a user-facing change?:

Add --node-deployment flag to enable distributed resizing for CSI drivers managing node-local volumes in DaemonSet deployments.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 11, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found here.

Details 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
Copy link
Copy Markdown
Contributor

Welcome @mnencia!

It looks like this is your first PR to kubernetes-csi/external-resizer 🎉. 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-csi/external-resizer 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 k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 11, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @mnencia. Thanks for your PR.

I'm waiting for a kubernetes-csi 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.

Details

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 Apr 11, 2026
For CSI drivers deployed as DaemonSets managing node-local volumes,
there is no central controller pod where a centralized external-resizer
can run. The provisioner and snapshotter sidecars already support
--node-deployment for this deployment model.

This adds the same capability to the external-resizer. When enabled,
each instance only processes resize requests for PVs whose nodeAffinity
matches the local node. The flag requires NODE_NAME env var and is
mutually exclusive with --leader-election.

The filtering is applied in the controller (pvNeedResize and
pvCanBeExpanded), covering both Resizer implementations without
changes to the Resizer interface.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Apr 11, 2026
@mnencia mnencia marked this pull request as ready for review April 12, 2026 09:21
@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 Apr 12, 2026
mnencia added a commit to mnencia/csi-driver-host-path that referenced this pull request Apr 12, 2026
Add the csi-resizer sidecar with --node-deployment=true using a custom
image (ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, which has not yet been merged
upstream.

This commit is for local testing only and should not be submitted
upstream until the resizer PR is merged.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
@mnencia
Copy link
Copy Markdown
Author

mnencia commented Apr 12, 2026

I have a working integration of this at dev/651-with-resizer on csi-driver-host-path, adding the csi-resizer with --node-deployment=true to the distributed DaemonSet deployment. Tested on a 3-node Kind cluster with volume expansion working correctly (including the node-filtering logic skipping non-local PVs as expected). That branch depends on this PR being merged. Related to #142.

mnencia added a commit to mnencia/csi-driver-host-path that referenced this pull request Apr 12, 2026
Add the csi-resizer sidecar with --node-deployment=true using a custom
image (ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, which has not yet been merged
upstream.

This commit is for local testing only and should not be submitted
upstream until the resizer PR is merged.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to cloudnative-pg/cloudnative-pg that referenced this pull request Apr 13, 2026
Replace the single-node StatefulSet csi-hostpath deployment with the
distributed DaemonSet variant, which runs the CSI driver on every node
with per-node provisioning, snapshotting, and resizing via
--node-deployment sidecars.

This enables multi-node test scenarios (pod failover, node drain, etc.)
where PVCs can be created on different nodes instead of all landing on
the same one.

The resizer sidecar uses a custom image
(ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, pending upstream merge.
The distributed deployment manifests are sourced from
mnencia/csi-driver-host-path#dev/651-with-resizer, pending
kubernetes-csi/csi-driver-host-path#653.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to cloudnative-pg/cloudnative-pg that referenced this pull request Apr 13, 2026
Replace the single-node StatefulSet csi-hostpath deployment with the distributed DaemonSet variant, which runs the CSI driver on every node with per-node provisioning, snapshotting, and resizing via --node-deployment sidecars.

This enables multi-node test scenarios (pod failover, node drain, etc.) where PVCs can be created on different nodes instead of all landing on the same one.

The resizer sidecar uses a custom image (ghcr.io/mnencia/csi-resizer:node-deployment) built from kubernetes-csi/external-resizer#573, pending upstream merge. The distributed deployment manifests are sourced from mnencia/csi-driver-host-path#dev/651-with-resizer, pending kubernetes-csi/csi-driver-host-path#653.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to mnencia/csi-driver-host-path that referenced this pull request Apr 13, 2026
Add the csi-resizer sidecar with --node-deployment=true using a custom
image (ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, which has not yet been merged
upstream.

This commit is for local testing only and should not be submitted
upstream until the resizer PR is merged.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to cloudnative-pg/cloudnative-pg that referenced this pull request Apr 13, 2026
Replace the single-node StatefulSet csi-hostpath deployment with the distributed DaemonSet variant, which runs the CSI driver on every node with per-node provisioning, snapshotting, and resizing via --node-deployment sidecars.

This enables multi-node test scenarios (pod failover, node drain, etc.) where PVCs can be created on different nodes instead of all landing on the same one.

The resizer sidecar uses a custom image (ghcr.io/mnencia/csi-resizer:node-deployment) built from kubernetes-csi/external-resizer#573, pending upstream merge. The distributed deployment manifests are sourced from mnencia/csi-driver-host-path#dev/651-with-resizer, pending kubernetes-csi/csi-driver-host-path#653.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to mnencia/csi-driver-host-path that referenced this pull request Apr 13, 2026
Add the csi-resizer sidecar with --node-deployment=true using a custom
image (ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, which has not yet been merged
upstream.

This commit is for local testing only and should not be submitted
upstream until the resizer PR is merged.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to cloudnative-pg/cloudnative-pg that referenced this pull request Apr 13, 2026
Replace the single-node StatefulSet csi-hostpath deployment with the distributed DaemonSet variant, which runs the CSI driver on every node with per-node provisioning, snapshotting, and resizing via --node-deployment sidecars.

This enables multi-node test scenarios (pod failover, node drain, etc.) where PVCs can be created on different nodes instead of all landing on the same one.

The resizer sidecar uses a custom image (ghcr.io/mnencia/csi-resizer:node-deployment) built from kubernetes-csi/external-resizer#573, pending upstream merge. The distributed deployment manifests are sourced from mnencia/csi-driver-host-path#dev/651-with-resizer, pending kubernetes-csi/csi-driver-host-path#653.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to cloudnative-pg/cloudnative-pg that referenced this pull request Apr 13, 2026
Replace the single-node StatefulSet csi-hostpath deployment with
the distributed DaemonSet variant, which runs the CSI driver on
every node with per-node provisioning, snapshotting, and resizing
via --node-deployment sidecars.

This enables multi-node test scenarios (pod failover, node drain,
etc.) where PVCs can be created on different nodes instead of all
landing on the same one.

The resizer sidecar uses a custom image
(ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, pending upstream merge.
The distributed deployment manifests are sourced from
mnencia/csi-driver-host-path#dev/651-with-resizer, pending
kubernetes-csi/csi-driver-host-path#653.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to mnencia/csi-driver-host-path that referenced this pull request Apr 13, 2026
Add the csi-resizer sidecar with --node-deployment=true using a custom
image (ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, which has not yet been merged
upstream.

This commit is for local testing only and should not be submitted
upstream until the resizer PR is merged.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to cloudnative-pg/cloudnative-pg that referenced this pull request Apr 13, 2026
Replace the single-node StatefulSet csi-hostpath deployment with
the distributed DaemonSet variant, which runs the CSI driver on
every node with per-node provisioning, snapshotting, and resizing
via --node-deployment sidecars.

This enables multi-node test scenarios (pod failover, node drain,
etc.) where PVCs can be created on different nodes instead of all
landing on the same one.

The resizer sidecar uses a custom image
(ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, pending upstream merge.
The distributed deployment manifests are sourced from
mnencia/csi-driver-host-path#dev/651-with-resizer, pending
kubernetes-csi/csi-driver-host-path#653.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to cloudnative-pg/cloudnative-pg that referenced this pull request Apr 13, 2026
Replace the single-node StatefulSet csi-hostpath deployment with
the distributed DaemonSet variant, which runs the CSI driver on
every node with per-node provisioning, snapshotting, and resizing
via --node-deployment sidecars.

This enables multi-node test scenarios (pod failover, node drain,
etc.) where PVCs can be created on different nodes instead of all
landing on the same one.

The resizer sidecar uses a custom image
(ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, pending upstream merge.
The distributed deployment manifests are sourced from
mnencia/csi-driver-host-path#dev/651-with-resizer, pending
kubernetes-csi/csi-driver-host-path#653.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to cloudnative-pg/cloudnative-pg that referenced this pull request Apr 13, 2026
Replace the single-node StatefulSet csi-hostpath deployment with
the distributed DaemonSet variant, which runs the CSI driver on
every node with per-node provisioning, snapshotting, and resizing
via --node-deployment sidecars.

This enables multi-node test scenarios (pod failover, node drain,
etc.) where PVCs can be created on different nodes instead of all
landing on the same one.

The resizer sidecar uses a custom image
(ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, pending upstream merge.
The distributed deployment manifests are sourced from
mnencia/csi-driver-host-path#dev/651-with-resizer, pending
kubernetes-csi/csi-driver-host-path#653.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit to cloudnative-pg/cloudnative-pg that referenced this pull request Apr 13, 2026
Replace the single-node StatefulSet csi-hostpath deployment with
the distributed DaemonSet variant, which runs the CSI driver on
every node with per-node provisioning, snapshotting, and resizing
via --node-deployment sidecars.

This enables multi-node test scenarios (pod failover, node drain,
etc.) where PVCs can be created on different nodes instead of all
landing on the same one.

The resizer sidecar uses a custom image
(ghcr.io/mnencia/csi-resizer:node-deployment) built from
kubernetes-csi/external-resizer#573, pending upstream merge.
The distributed deployment manifests are sourced from
mnencia/csi-driver-host-path#dev/651-with-resizer, pending
kubernetes-csi/csi-driver-host-path#653.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
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. kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

distributed resizing

2 participants