-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make extension and clusterextension api consistent
Signed-off-by: Ankita Thomas <ankithom@redhat.com>
- Loading branch information
1 parent
6d73b73
commit a934c27
Showing
22 changed files
with
775 additions
and
394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package v1alpha1 | ||
|
||
import "github.com/operator-framework/operator-controller/internal/conditionsets" | ||
|
||
const ( | ||
TypeInstalled = "Installed" | ||
TypeResolved = "Resolved" | ||
// TypeDeprecated is a rollup condition that is present when | ||
// any of the deprecated conditions are present. | ||
TypeDeprecated = "Deprecated" | ||
TypePackageDeprecated = "PackageDeprecated" | ||
TypeChannelDeprecated = "ChannelDeprecated" | ||
TypeBundleDeprecated = "BundleDeprecated" | ||
// TypeProgressing indicates whether operator-controller is | ||
// reconciling, installing, updating or deleting a ClusterExtension or Extension. | ||
TypeProgressing = "Progressing" | ||
// TODO(user): add more Types, here and into init() | ||
|
||
ReasonBundleLookupFailed = "BundleLookupFailed" | ||
ReasonInstallationFailed = "InstallationFailed" | ||
ReasonInstallationStatusUnknown = "InstallationStatusUnknown" | ||
ReasonInstallationSucceeded = "InstallationSucceeded" | ||
ReasonInvalidSpec = "InvalidSpec" | ||
ReasonResolutionFailed = "ResolutionFailed" | ||
ReasonResolutionUnknown = "ResolutionUnknown" | ||
ReasonSuccess = "Success" | ||
ReasonDeprecated = "Deprecated" | ||
ReasonProgressing = "Progressing" | ||
ReasonFailedToReachDesiredIntent = "FailedToReachDesiredIntent" | ||
ReasonReachedDesiredIntent = "ReachedDesiredIntent" | ||
) | ||
|
||
func init() { | ||
// TODO(user): add Types from above | ||
conditionsets.ConditionTypes = append(conditionsets.ConditionTypes, | ||
TypeInstalled, | ||
TypeResolved, | ||
TypeDeprecated, | ||
TypePackageDeprecated, | ||
TypeChannelDeprecated, | ||
TypeBundleDeprecated, | ||
TypeProgressing, | ||
) | ||
// TODO(user): add Reasons from above | ||
conditionsets.ConditionReasons = append(conditionsets.ConditionReasons, | ||
ReasonInstallationSucceeded, | ||
ReasonResolutionFailed, | ||
ReasonResolutionUnknown, | ||
ReasonBundleLookupFailed, | ||
ReasonInstallationFailed, | ||
ReasonInstallationStatusUnknown, | ||
ReasonInvalidSpec, | ||
ReasonSuccess, | ||
ReasonDeprecated, | ||
ReasonProgressing, | ||
ReasonFailedToReachDesiredIntent, | ||
ReasonReachedDesiredIntent, | ||
) | ||
} | ||
|
||
const ( | ||
SourceTypePackage = "package" | ||
) | ||
|
||
type UpgradeConstraintPolicy string | ||
|
||
const ( | ||
// The UpgradeConstraintPolicyEnforce policy only allows upgrades if | ||
// the new version satisfies the upgrade constraints set by the package author. | ||
UpgradeConstraintPolicyEnforce UpgradeConstraintPolicy = "Enforce" | ||
|
||
// The UpgradeConstraintPolicyIgnore policy allows upgrades or downgrades | ||
// to any available version of the package, ignoring any upgrade paths | ||
// 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" | ||
) | ||
|
||
type SourcePackage struct { | ||
//+kubebuilder:validation:MaxLength:=48 | ||
//+kubebuilder:validation:Pattern:=^[a-z0-9]+(-[a-z0-9]+)*$ | ||
// name specifies the name of the name of the package | ||
Name string `json:"name"` | ||
|
||
//+kubebuilder:validation:MaxLength:=64 | ||
//+kubebuilder:validation:Pattern=`^(\s*(=||!=|>|<|>=|=>|<=|=<|~|~>|\^)\s*(v?(0|[1-9]\d*|[x|X|\*])(\.(0|[1-9]\d*|x|X|\*]))?(\.(0|[1-9]\d*|x|X|\*))?(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?)\s*)((?:\s+|,\s*|\s*\|\|\s*)(=||!=|>|<|>=|=>|<=|=<|~|~>|\^)\s*(v?(0|[1-9]\d*|x|X|\*])(\.(0|[1-9]\d*|x|X|\*))?(\.(0|[1-9]\d*|x|X|\*]))?(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?)\s*)*$` | ||
//+kubebuilder:Optional | ||
// Version is an optional semver constraint on the package version. If not specified, the latest version available of the package will be installed. | ||
// If specified, the specific version of the package will be installed so long as it is available in any of the content sources available. | ||
// Examples: 1.2.3, 1.0.0-alpha, 1.0.0-rc.1 | ||
// | ||
// For more information on semver, please see https://semver.org/ | ||
// version constraint definition | ||
Version string `json:"version,omitempty"` | ||
|
||
//+kubebuilder:validation:MaxLength:=48 | ||
//+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 | ||
// | ||
// upgradeConstraintPolicy Defines the policy for how to handle upgrade constraints | ||
UpgradeConstraintPolicy UpgradeConstraintPolicy `json:"upgradeConstraintPolicy,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.