Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add upgradeConstraintPolicy field to Operator spec #439

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions api/v1alpha1/operator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ import (
"github.com/operator-framework/operator-controller/internal/conditionsets"
)

type UpgradeConstraintPolicy string

const (
// The operator will only upgrade if the new version satisfies
// the upgrade constraints set by the package author.
UpgradeConstraintPolicyEnforce UpgradeConstraintPolicy = "Enforce"

// Unsafe option which allows an operator to be
// upgraded or downgraded to any available version of the package and
// ignore the upgrade path designed by package authors.
// This assumes that users independently verify the outcome of the changes.
// Use with caution as this can lead to unknown and potentially
// disastrous results such as data loss.
UpgradeConstraintPolicyIgnore UpgradeConstraintPolicy = "Ignore"
)

// OperatorSpec defines the desired state of Operator
type OperatorSpec struct {
//+kubebuilder:validation:MaxLength:=48
Expand All @@ -42,6 +58,13 @@ type OperatorSpec struct {
//+kubebuilder:validation:Pattern:=^[a-z0-9]+([\.-][a-z0-9]+)*$
// Channel constraint definition
Channel string `json:"channel,omitempty"`

//+kubebuilder:validation:Enum:=Enforce;Ignore
//+kubebuilder:default:=Enforce
//+kubebuilder:Optional
//
// Defines the policy for how to handle upgrade constraints
UpgradeConstraintPolicy UpgradeConstraintPolicy `json:"upgradeConstraintPolicy,omitempty"`
}

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ spec:
maxLength: 48
pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
type: string
upgradeConstraintPolicy:
default: Enforce
description: Defines the policy for how to handle upgrade constraints
enum:
- Enforce
- Ignore
type: string
version:
description: "Version is an optional semver constraint on the package
version. If not specified, the latest version available of the package
Expand Down