Skip to content

eve-k: add config-property 'storage.longhorn.node-drain-policy'#6000

Open
andrewd-zededa wants to merge 1 commit into
lf-edge:masterfrom
andrewd-zededa:eve-k-lh-drain-policy-prop
Open

eve-k: add config-property 'storage.longhorn.node-drain-policy'#6000
andrewd-zededa wants to merge 1 commit into
lf-edge:masterfrom
andrewd-zededa:eve-k-lh-drain-policy-prop

Conversation

@andrewd-zededa

@andrewd-zededa andrewd-zededa commented May 29, 2026

Copy link
Copy Markdown
Contributor

Description

Keep default at longhorn recommended default:
'block-for-eviction-if-contains-last-replica'

Which blocks until another node has a replica,
other than the node being drained.

See longhorn docs for more info:
https://longhorn.io/docs/1.9.1/maintenance/maintenance/#node-drain-policy-recommendations

zedkube.go applies this in the kubeCfgTimer as well as on any global config changes.

PR dependencies

None

How to test and validate this PR

  • Set config property storage.longhorn.node-drain-policy to a non-default value
  • eve enter kube
  • kubectl -n longhorn-system get settings.longhorn.io/node-drain-policy
  • Verify new value applied.

Changelog notes

Support configurable drain policy for longhorn volumes.

PR Backports

- 17.0-stable: Yes
- 16.0-stable: No, as the feature is not available there.
- 14.5-stable: No, as the feature is not available there.
- 13.4-stable: No, as the feature is not available there.

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR

And the last but not least:

  • I've checked the boxes above, or I've provided a good reason why I didn't
    check them.

Please, check the boxes above after submitting the PR in interactive mode.

@codecov

codecov Bot commented May 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 11.76471% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.68%. Comparing base (535a10a) to head (5a0be55).
⚠️ Report is 23 commits behind head on master.

Files with missing lines Patch % Lines
pkg/pillar/kubeapi/longhornsnap.go 0.00% 26 Missing ⚠️
pkg/pillar/cmd/zedkube/zedkube.go 0.00% 17 Missing ⚠️
pkg/pillar/types/global.go 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6000      +/-   ##
==========================================
+ Coverage   20.25%   20.68%   +0.42%     
==========================================
  Files         490      500      +10     
  Lines       91670    93419    +1749     
==========================================
+ Hits        18572    19320     +748     
- Misses      71544    72367     +823     
- Partials     1554     1732     +178     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrewd-zededa andrewd-zededa force-pushed the eve-k-lh-drain-policy-prop branch from e14add3 to 7a92fe6 Compare June 1, 2026 16:22
@andrewd-zededa andrewd-zededa marked this pull request as ready for review June 1, 2026 16:22
Comment thread docs/CONFIG-PROPERTIES.md
| storage.zfs.reserved.percent | integer percent | 20 | 1 | 99 | min. percent of persist partition reserved for zfs performance |
| storage.longhorn.disk.reserved.gigabytes | integer GB | 2 | 0 | 1048576 | per-disk storage reserved by Longhorn on the local node; overrides Longhorn's default 25% reservation. 0 sets storageReserved to 0 bytes (no reservation). 1048576 disables EVE's override, leaving Longhorn's current value in place |
| storage.longhorn.snapshot.cron | cron string | `0 0 * * *` | - | - | cron schedule for Longhorn recurring snapshots; empty string disables. Snapshots bound delta rebuilds after node power loss to writes since the last snapshot. Default daily at midnight UTC. Standard 5-field cron syntax. EVE-k only. |
| storage.longhorn.node-drain-policy | string | `allow-if-replica-is-stopped` | - | - | Longhorn cluster-wide node-drain-policy setting. Controls whether a node drain is permitted when the node holds Longhorn replicas. Valid values: `block-for-eviction`, `block-for-eviction-if-contains-last-replica`, `allow-if-replica-is-stopped`, `always-allow`. EVE-k only. |

@milan-zededa milan-zededa Jun 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cluster-wide

Does it mean that every node should have the same value configured?
Is it enough if only one of the nodes has this value set in the device config, and other keep the empty default?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

All nodes should have this value set identically

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens if they are configured differently?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

On every boot event of a node, the cluster-wide setting would switch to the config prop value set for that node.

Keep default at longhorn recommended default:
'block-for-eviction-if-contains-last-replica'

Which blocks until another node has a replica,
other than the node being drained.

See longhorn docs for more info:
https://longhorn.io/docs/1.9.1/maintenance/maintenance/#node-drain-policy-recommendations

zedkube.go applies this in the kubeCfgTimer as well
as on any global config changes.

Signed-off-by: Andrew Durbin <andrewd@zededa.com>
@andrewd-zededa andrewd-zededa force-pushed the eve-k-lh-drain-policy-prop branch from 7a92fe6 to 5a0be55 Compare June 18, 2026 19:55
@andrewd-zededa

Copy link
Copy Markdown
Contributor Author

Rebased and resolved conflict

@andrewd-zededa andrewd-zededa added the next-17.0.0-rc PR must be present in the next 17.0.0-lts release label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

next-17.0.0-rc PR must be present in the next 17.0.0-lts release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants