Skip to content

fix(instancemanager): honor node selector setting while setup the pod#4627

Open
COLDTURNIP wants to merge 1 commit intolonghorn:masterfrom
COLDTURNIP:12834-im-node-selector
Open

fix(instancemanager): honor node selector setting while setup the pod#4627
COLDTURNIP wants to merge 1 commit intolonghorn:masterfrom
COLDTURNIP:12834-im-node-selector

Conversation

@COLDTURNIP
Copy link
Copy Markdown
Member

Which issue(s) this PR fixes:

Issue longhorn/longhorn#12834

What this PR does / why we need it:

Special notes for your reviewer:

Additional documentation or context

@COLDTURNIP COLDTURNIP requested a review from a team April 1, 2026 15:59
@COLDTURNIP COLDTURNIP self-assigned this Apr 1, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b8c7377b-26aa-455a-bbb4-c9887e54e8be

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 longhorn/longhorn#12834 by ensuring InstanceManager pod creation honors the system-managed-components-node-selector setting, avoiding rapid failure/recreate loops when the selected node doesn’t satisfy the selector.

Changes:

  • Add a new InstanceManager condition reason for node selector mismatch (NodeSelectorNotMatching).
  • Check whether the target node matches the system-managed node selector before deciding pod deletion/recreation and before creating a pod.
  • Introduce a helper (isNodeSelectorMatchingForIM) to evaluate selector vs. Kubernetes Node labels.

Reviewed changes

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

File Description
k8s/pkg/apis/longhorn/v1beta2/instancemanager.go Adds a new condition reason constant used to report node selector mismatch.
controller/instance_manager_controller.go Adds selector-vs-node matching logic to prevent creating IM pods on nodes that don’t satisfy the configured selector.

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

@derekbit
Copy link
Copy Markdown
Member

derekbit commented Apr 1, 2026

@COLDTURNIP Please address the comments from Copilot. Thanks.

@derekbit derekbit force-pushed the 12834-im-node-selector branch 2 times, most recently from 802b266 to de650ac Compare April 3, 2026 02:58
longhorn-12834

Signed-off-by: Raphanus Lo <yunchang.lo@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants