Skip to content

Upgrade/longhorn 1.9.2 - #1956

Merged
m-brando merged 25 commits into
masterfrom
upgrade/longhorn-1.9.2
Feb 6, 2026
Merged

Upgrade/longhorn 1.9.2#1956
m-brando merged 25 commits into
masterfrom
upgrade/longhorn-1.9.2

Conversation

@m-brando

@m-brando m-brando commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

This PR upgrades longhron from v1.8.1 to v1.9.2.

Before upgrading

Notes:
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

    • Added a version-aware pre-upgrade step that applies a node-drain-policy for older Longhorn installations; non-fatal errors emit warnings and installation continues.
  • Chores

    • Upgraded Longhorn baseline to v1.9.2 (images and metadata).
    • Migrated CRDs from v1beta1 to v1beta2 and extended schemas with new fields.
    • Updated default node-drain-policy and set default-data-locality to best-effort.
    • Bumped Longhorn setting templates and two deployment image tags.

Matus Brandys and others added 5 commits January 29, 2026 12:24
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.
@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds 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

Cohort / File(s) Summary
Longhorn manifests & CRDs
services/kuber/server/manifests/longhorn.yaml
Bumps Longhorn baseline to v1.9.2: updates images and app.kubernetes.io/version labels, promotes many CRDs from v1beta1v1beta2 (deprecates v1beta1), and extends CRD schemas/status with new fields (e.g., starting, ublkID, uuid).
Defaults & templates
services/kuber/server/manifests/claudie-defaults.yaml, services/kuber/templates/enable-ca.goyaml
Updates Setting resources to longhorn.io/v1beta2; changes node-drain-policy value to block-for-eviction-if-contains-last-replica; sets default-data-locality to best-effort.
Installer longhorn utils
services/kuber/server/domain/utils/longhorn/longhorn.go
Adds semver and logger imports, constants (minVersionForDrainPolicy, nodeDrainPolicyValue), and helper methods: getCurrentLonghornVersion, isVersionBelow, patchNodeDrainPolicy. Implements a version-aware pre-install patch of node-drain-policy with non-fatal warnings on errors.
Kustomization image tags
manifests/claudie/kustomization.yaml
Updates two Claudie image newTag values for autoscaler-adapter and kuber.

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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change as upgrading Longhorn to version 1.9.2, which aligns with the primary objective of the changeset.
Linked Issues check ✅ Passed The PR addresses the core requirement to deploy Longhorn v1.9.2 [#1910] through manifest updates, version-aware patching logic, and image upgrades; compatibility appears maintained through CRD version migrations and pre-upgrade safety checks.
Out of Scope Changes check ✅ Passed All changes directly support the Longhorn upgrade objective: manifest versions updated to 1.9.2, CRD schemas migrated to v1beta2, pre-upgrade node-drain-policy patching added, and container images bumped appropriately.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch upgrade/longhorn-1.9.2

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.

@m-brando m-brando added the test-set-ordinary Will select ordinary test-sets that tests the general functionally of building/modifying clusters label Jan 30, 2026
Comment thread services/kuber/server/domain/utils/longhorn/longhorn.go
Comment thread services/kuber/server/domain/utils/longhorn/longhorn.go
Comment thread services/kuber/server/domain/utils/longhorn/longhorn.go
Comment thread services/kuber/server/domain/utils/longhorn/longhorn.go

@jakubhlavacka jakubhlavacka left a comment

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.

Left some comments. Mostly questions.

@coderabbitai coderabbitai Bot left a comment

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.

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.

Comment thread services/kuber/server/domain/utils/longhorn/longhorn.go
@m-brando
m-brando enabled auto-merge February 6, 2026 07:22
@m-brando
m-brando requested review from jakubhlavacka and removed request for Despire February 6, 2026 07:33
@m-brando
m-brando added this pull request to the merge queue Feb 6, 2026
Merged via the queue into master with commit ba6b179 Feb 6, 2026
@m-brando
m-brando deleted the upgrade/longhorn-1.9.2 branch February 6, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-set-ordinary Will select ordinary test-sets that tests the general functionally of building/modifying clusters

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chore: Upgrade Longhorn

3 participants