longhorn/enhancements/20230815-engine-upgrade-enforcement.md
Chin-Ya Huang 3b04fa8c02 feat(lep): engine upgrade enforcement design
ref: 5842

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
2023-08-14 20:25:47 +08:00

3.1 KiB

Engine Upgrade Enforcement

Summary

The current Longhorn upgrade process lacks enforcement of the engine version, potentially leading to compatibility issues. To address this concern, we propose the implementation of an Engine Upgrade Enforcement feature.

https://github.com/longhorn/longhorn/issues/5842

Motivation

Longhorn needs to be able to safely deprecated and remove the certain fields, such as [TASK] Remove deprecated instances field and instance type from instance manager CR #5844

Goals

The primary goal of this proposal is to enhance Longhorn's upgrade mechanism by introducing logic that prevents upgrading to Longhorn versions while there are incompatible engine images in use.

Non-goals [optional]

None

Proposal

This proposal focuses on preventing users from upgrading to unsupported or incompatible engine versions. This enhancement will build upon the existing pre-upgrade checks to include validation of engine version compatibility.

User Stories

Story 1: Preventing Incompatible Upgrades

Previously, users had the freedom to continue using an older engine version after a Longhorn upgrade. With the proposed enhancement, the Longhorn upgrade process will be blocked if it includes an incompatible engine version. This will enforce users to manually upgrade the engine to a compatible version before proceeding with the Longhorn upgrade.

User Experience In Detail

User will perform upgrade a usual. Longhorn will examine the compatibility of the current engine version. If the current engine version is incompatible with the target engine version for the upgrade, Longhorn will halt the upgrade process and prompt the user to address the engine version mismatch before proceeding.

API changes

None

Design

Implementation Overview

The implementation approach for this feature will be similar to the Upgrade Path Enforcement feature.

Key implementation steps include:

  1. Enhance the function CheckUpgradePathSupported(...) to include the new checks.
func CheckUpgradePathSupported(namespace string, lhClient lhclientset.Interface) error {
	if err := CheckLHUpgradePathSupported(namespace, lhClient); err != nil {
		return err
	}

	return CheckEngineUpgradePathSupported(namespace, lhClient, emeta.GetVersion())
}
  1. Retrieve the current engine images being used and record the versions.
  2. Prevent upgrades if the targeting engine version is detact to be downgrading.
  3. Prevent upgrades if the engine image version is lower than the minimum required version for the new engine image controller API.

Test plan

  • Create unit test for the new logic.
  • Run manual test to verify the handling of incompatible engine image versions (e.g., Longhorn v1.4.x -> v1.5.x -> v1.6.x.)

Upgrade strategy

None

Note [optional]

None