Skip to content

fix: fallback to API server on missing Node topology key - #1485

Merged
k8s-ci-robot merged 3 commits into
kubernetes-csi:masterfrom
ryan-mist:node-topology-label-fix
May 11, 2026
Merged

fix: fallback to API server on missing Node topology key#1485
k8s-ci-robot merged 3 commits into
kubernetes-csi:masterfrom
ryan-mist:node-topology-label-fix

Conversation

@ryan-mist

Copy link
Copy Markdown
Contributor

What type of PR is this?
/kind bug

What this PR does / why we need it:e
This PR adds a fallback to the API server in Node Topology if the topology labels on the Node do not match the labels on the CSINode.

This fixes a bug where during provisioning, if the Node does not yet have all topology labels then provisioning continually fails. Even when the Node eventually does have all the labels.

Testing After Fix

  1. Launch Node
    In this case, I use EKS Auto to launch the Node. There are 4 required topology labels are:
eks.amazonaws.com/compute-type
kubernetes.io/os
topology.ebs.csi.eks.amazonaws.com/zone
topology.kubernetes.io/zone
  1. Remove A Required Topology Label From The Node
k label node {NODE_LABEL} eks.amazonaws.com/compute-type-
  1. Create Stateful Set with volumeClaimTemplate so PVC created and volume provisioned
    Looking at the PVC events
Warning  ProvisioningFailed    40s (x7 over 103s)     ebs.csi.eks.amazonaws.com_ebscsicontroller-7b864487cb-dgx8v_07b290e6-86d7-4bb5-a604-410cd0ef97ba  error generating accessibility requirements: topology labels from selected node map[] does not match topology keys from CSINode [eks.amazonaws.com/compute-type kubernetes.io/os topology.ebs.csi.eks.amazonaws.com/zone topology.kubernetes.io/zone]
  1. Add Label Back Onto The Node
k label node i-096987243751a321d eks.amazonaws.com/compute-type=auto
  1. PVC Should Be Bound Soon After
NAME                     STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   VOLUMEATTRIBUTESCLASS   AGE
data-my-stateful-app-0   Bound    pvc-a733f911-6d1a-4e30-9c8d-8f249b465ea5   8Gi        RWO            auto-ebs-sc    <unset>                 4m37s
data-my-stateful-app-1   Bound    pvc-6b8dac92-770e-4ba6-ae0c-c2f57dbd833e   8Gi        RWO            auto-ebs-sc    <unset>                 7s

Before this new version of external provisioner, PVCs would remain unbound with provisioning failures of:

error generating accessibility requirements: topology labels from selected node map[] does not match topology keys from CSINode

Which issue(s) this PR fixes:

Fixes #1478

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 10, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Welcome @ryan-mist!

It looks like this is your first PR to kubernetes-csi/external-provisioner 🎉. 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-provisioner 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 Mar 10, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @ryan-mist. 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 requested review from gnufied and pohly March 10, 2026 18:57
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 10, 2026
@jsafrane

Copy link
Copy Markdown
Contributor

/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 Mar 19, 2026
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 25, 2026
@jsafrane
jsafrane requested a review from Copilot April 14, 2026 09:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a topology-provisioning failure mode where stale/incomplete cached Node labels can cause repeated provisioning errors even after the Node later gains the missing topology labels, by falling back to re-reading Node labels when cached labels are missing required topology keys.

Changes:

  • Adjust getTopologyFromNodeName to fall back to fetching Node labels (via the lister) when cached Node labels are missing required topology keys.
  • Update extractTopologyTerm to return the available label map on missing-key errors (improves error context).
  • Add a regression test that reproduces “initially missing label, later added label” behavior and validates successful provisioning on retry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/controller/topology.go Adds cache-miss-on-missing-keys fallback and preserves label context when topology keys are missing.
pkg/controller/topology_test.go Adds a unit test covering the missing-label-then-added-label retry scenario.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/controller/topology.go Outdated
Comment thread pkg/controller/topology.go
@ryan-mist
ryan-mist force-pushed the node-topology-label-fix branch from fc52847 to 427f790 Compare April 28, 2026 06:05
@ryan-mist
ryan-mist requested a review from jsafrane May 5, 2026 17:23
@jsafrane

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 11, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jsafrane, ryan-mist

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

The pull request process is described 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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 11, 2026
@k8s-ci-robot
k8s-ci-robot merged commit af30071 into kubernetes-csi:master May 11, 2026
7 checks passed
@msau42

msau42 commented May 28, 2026

Copy link
Copy Markdown
Collaborator

/cherry-pick release-6.2

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@msau42: new pull request created: #1516

Details

In response to this:

/cherry-pick release-6.2

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.

@msau42

msau42 commented May 28, 2026

Copy link
Copy Markdown
Collaborator

/cherry-pick release-6.1

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@msau42: new pull request created: #1517

Details

In response to this:

/cherry-pick release-6.1

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.

@msau42

msau42 commented May 28, 2026

Copy link
Copy Markdown
Collaborator

/cherry-pick release-6.0

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@msau42: new pull request created: #1518

Details

In response to this:

/cherry-pick release-6.0

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.

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. kind/bug Categorizes issue or PR as related to a bug. 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-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.

Stale Node Topology Label Cache causes Volume Provisioning Failures Until Restart

6 participants