Skip to content

Refactor legacy upgrade constraint semantics behind an interface #397

Closed
@m1kola

Description

@m1kola

Please read RFC for better formatting and full scope. The excerpt below is just to indicate the scope covered by this specific issue.

We need to

Solver

The solver needs to be able to switch between upgrade constraint semantics based on rules defined above (see Fig 1).

Note that no matter the positions of ForceSemverUpgradeConstraints feature gate and value of .spec.upgradeConstraintPolicy we still need to apply Operator’s other constraints. This means that .spec.channel and .spec.version need to be taken into account during the resolution process, if these fields were set:

  • If the .spec.version field specifies a version or range, resolution must choose from a version that falls with that version or range
  • If the .spec.channel field specifies a channel, resolution must choose from a version that is a member of that channel

Refactoring of existing support of legacy semantics

In preparation of introducing of semver we need to:

  • Define an interface common for all the semantics
  • Refactor existing code which provides support of legacy semantics to match the interface

The idea is that there will be a function with roughly the following signature:

type Successors func(currentBundle string) []string

Where currentBundle uniquely identifies the currently installed bundle and the return value is a slice uniquely identifying possible successors.
For the legacy semantics possible successors will be bundles according to the replaces/skips/skipRange.

Reporting resolution issues must also happen as described in the RFC:

In case of errors during the resolution - issues must be reported via status update of the Operator. This applies to all semantics and all positions of the feature gate.

Operator is expected to set or update the condition of type Resolved to False with Reason set to ResolutionFailed and provide a meaningful error message.

conditions, metav1.Condition{
	Type:           	operatorsv1alpha1.TypeResolved,
	Status:         	metav1.ConditionFalse,
	Reason:         	operatorsv1alpha1.ReasonResolutionFailed,
	Message:        	message,
	ObservedGeneration: generation,
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions