@@ -22,6 +22,22 @@ import (
2222 "github.com/operator-framework/operator-controller/internal/conditionsets"
2323)
2424
25+ type UpgradeConstraintPolicy string
26+
27+ const (
28+ // The operator will only upgrade if the new version satisfies
29+ // the upgrade constraints set by the package author.
30+ UpgradeConstraintPolicyEnforce UpgradeConstraintPolicy = "Enforce"
31+
32+ // Unsafe option which allows an operator to be
33+ // upgraded or downgraded to any available version of the package and
34+ // ignore the upgrade path designed by package authors.
35+ // This assumes that users independently verify the outcome of the changes.
36+ // Use with caution as this can lead to unknown and potentially
37+ // disastrous results such as data loss.
38+ UpgradeConstraintPolicyIgnore UpgradeConstraintPolicy = "Ignore"
39+ )
40+
2541// OperatorSpec defines the desired state of Operator
2642type OperatorSpec struct {
2743 //+kubebuilder:validation:MaxLength:=48
@@ -42,6 +58,13 @@ type OperatorSpec struct {
4258 //+kubebuilder:validation:Pattern:=^[a-z0-9]+([\.-][a-z0-9]+)*$
4359 // Channel constraint definition
4460 Channel string `json:"channel,omitempty"`
61+
62+ //+kubebuilder:validation:Enum:=Enforce;Ignore
63+ //+kubebuilder:default:=Enforce
64+ //+kubebuilder:Optional
65+ //
66+ // Defines the policy for how to handle upgrade constraints
67+ UpgradeConstraintPolicy UpgradeConstraintPolicy `json:"upgradeConstraintPolicy,omitempty"`
4568}
4669
4770const (
0 commit comments