Upgrade/longhorn 1.9.2 - #1956
Merged
Merged
Conversation
Before applying longhorn.yaml, check if an older version of Longhorn is installed. If the version is below v1.9.2, patch the node-drain-policy setting to "block-for-eviction-if-contains-last-replica" to ensure compatibility during the upgrade process.
Contributor
WalkthroughAdds Longhorn v1.9.2 manifests and CRD upgrades, updates default Longhorn settings, and adds installer logic to detect older Longhorn versions and conditionally patch the node-drain-policy before applying manifests. Changes
Sequence Diagram(s)sequenceDiagram
participant Installer as "Installer"
participant Kubectl as "kubectl"
participant KubeAPI as "Kubernetes API"
Installer->>KubeAPI: Read longhorn-system Deployment labels (getCurrentLonghornVersion)
alt version found and isVersionBelow(minVersionForDrainPolicy)
Installer->>Kubectl: patchNodeDrainPolicy(node-drain-policy)
Kubectl->>KubeAPI: PATCH Setting longhorn-system/node-drain-policy
KubeAPI-->>Kubectl: patch response
Kubectl-->>Installer: success/failure (logged, non-fatal)
else version not found or compare error
KubeAPI-->>Installer: warn and continue
end
Installer->>KubeAPI: apply Longhorn manifests (v1.9.2)
KubeAPI-->>Installer: apply response
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
jakubhlavacka
left a comment
Contributor
There was a problem hiding this comment.
Left some comments. Mostly questions.
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@services/kuber/server/domain/utils/longhorn/longhorn.go`:
- Around line 227-231: The current handler around the kc.KubectlGet call
swallows all kubectl errors and returns nil, treating any failure as "not
installed"; update the error handling so that when kc.KubectlGet(...) returns an
error you propagate that error (e.g., return the empty version string and the
err) instead of returning nil, allowing SetUp to receive and log
connectivity/auth errors; locate the kc.KubectlGet call in the Longhorn
version-read function and change the error return to propagate err to the
caller.
samuelstolicny
approved these changes
Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR upgrades longhron from v1.8.1 to v1.9.2.
Before upgrading
kubectl get volumes -n longhorn-systemNotes:
To force the upgrade in a Claudie-managed cluster, changes are required in the input manifest (for example, adding a label to the node pool).
Close #1910
Summary by CodeRabbit
New Features
Chores