Skip to content

Commit eb4ca3f

Browse files
committed
more descriptive upgrade contstraint policy constants
1 parent ac5c28b commit eb4ca3f

File tree

6 files changed

+47
-47
lines changed

6 files changed

+47
-47
lines changed

api/v1alpha1/clusterextension_types.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ type CRDUpgradeSafetyPolicy string
3333
const (
3434
// The extension will only upgrade if the new version satisfies
3535
// the upgrade constraints set by the package author.
36-
UpgradeConstraintPolicyEnforce UpgradeConstraintPolicy = "Enforce"
36+
UpgradeConstraintPolicyCatalogProvided UpgradeConstraintPolicy = "CatalogProvided"
3737

3838
// Unsafe option which allows an extension to be
3939
// upgraded or downgraded to any available version of the package and
4040
// ignore the upgrade path designed by package authors.
4141
// This assumes that users independently verify the outcome of the changes.
4242
// Use with caution as this can lead to unknown and potentially
4343
// disastrous results such as data loss.
44-
UpgradeConstraintPolicyIgnore UpgradeConstraintPolicy = "Ignore"
44+
UpgradeConstraintPolicySelfCertified UpgradeConstraintPolicy = "SelfCertified"
4545
)
4646

4747
// ClusterExtensionSpec defines the desired state of ClusterExtension
@@ -337,8 +337,8 @@ type CatalogSource struct {
337337
//
338338
// If unspecified, the default value is "Enforce".
339339
//
340-
//+kubebuilder:validation:Enum:=Enforce;Ignore
341-
//+kubebuilder:default:=Enforce
340+
//+kubebuilder:validation:Enum:=CatalogProvided;SelfCertified
341+
//+kubebuilder:default:=CatalogProvided
342342
//+optional
343343
UpgradeConstraintPolicy UpgradeConstraintPolicy `json:"upgradeConstraintPolicy,omitempty"`
344344
}

config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ spec:
330330
type: object
331331
x-kubernetes-map-type: atomic
332332
upgradeConstraintPolicy:
333-
default: Enforce
333+
default: CatalogProvided
334334
description: |-
335335
upgradeConstraintPolicy is an optional field that controls whether
336336
the upgrade path(s) defined in the catalog are enforced for the package
@@ -350,8 +350,8 @@ spec:
350350
351351
If unspecified, the default value is "Enforce".
352352
enum:
353-
- Enforce
354-
- Ignore
353+
- CatalogProvided
354+
- SelfCertified
355355
type: string
356356
version:
357357
description: |-

docs/drafts/upgrade-support.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ spec:
4242
packageName: <package_name>
4343
serviceAccount:
4444
name: <service_account>
45-
upgradeConstraintPolicy: Ignore
45+
upgradeConstraintPolicy: SelfCertified
4646
version: "<version_or_version_range>"
4747
```
4848

4949
where setting the `upgradeConstraintPolicy` to:
5050

51-
`Ignore`
51+
`SelfCertified`
5252
: Does not limit the next version to the set of successors, and instead allows for any downgrade, sidegrade, or upgrade.
5353

54-
`Enforce`
55-
: Only allows the next version to come from the successors list. This is the default value. If the `upgradeConstraintPolicy` parameter is not defined in an extension's CR, then the policy is set to `Enforce` by default.
54+
`CatalogProvided`
55+
: Only allows the next version to come from the successors list. This is the default value. If the `upgradeConstraintPolicy` parameter is not defined in an extension's CR, then the policy is set to `CatalogProvided` by default.
5656

5757
## Upgrades
5858

@@ -74,11 +74,11 @@ You must verify and perform upgrades manually in cases where automatic upgrades
7474

7575
**Warning:** If you want to force an upgrade manually, you must thoroughly verify the outcome before applying any changes to production workloads. Failure to test and verify the upgrade might lead to catastrophic consequences such as data loss.
7676

77-
As a package admin, if you must upgrade or downgrade to version that might be incompatible with the currently installed version, you can set the `.spec.upgradeConstraintPolicy` field to `Ignore` on the relevant `ClusterExtension` resource.
77+
As a package admin, if you must upgrade or downgrade to version that might be incompatible with the currently installed version, you can set the `.spec.upgradeConstraintPolicy` field to `SelfCertified` on the relevant `ClusterExtension` resource.
7878

79-
If you set the field to `Ignore`, no upgrade constraints are set on the package. As a result, you can change the version to any version available in the catalogs for a given package.
79+
If you set the field to `SelfCertified`, no upgrade constraints are set on the package. As a result, you can change the version to any version available in the catalogs for a given package.
8080

81-
Example `ClusterExtension` with `.spec.upgradeConstraintPolicy` field set to `Ignore`:
81+
Example `ClusterExtension` with `.spec.upgradeConstraintPolicy` field set to `SelfCertified`:
8282

8383
```yaml
8484
apiVersion: olm.operatorframework.io/v1alpha1
@@ -91,7 +91,7 @@ spec:
9191
catalog:
9292
packageName: argocd-operator
9393
version: 0.6.0
94-
upgradeConstraintPolicy: Ignore
94+
upgradeConstraintPolicy: SelfCertified
9595
install:
9696
namespace: argocd
9797
serviceAccout:

internal/resolve/catalog.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (r *CatalogResolver) Resolve(ctx context.Context, ext *ocv1alpha1.ClusterEx
8383
predicates = append(predicates, filter.InMastermindsSemverRange(versionRangeConstraints))
8484
}
8585

86-
if ext.Spec.Source.Catalog.UpgradeConstraintPolicy != ocv1alpha1.UpgradeConstraintPolicyIgnore && installedBundle != nil {
86+
if ext.Spec.Source.Catalog.UpgradeConstraintPolicy != ocv1alpha1.UpgradeConstraintPolicySelfCertified && installedBundle != nil {
8787
successorPredicate, err := filter.SuccessorsOf(installedBundle, packageFBC.Channels...)
8888
if err != nil {
8989
return fmt.Errorf("error finding upgrade edges: %w", err)

0 commit comments

Comments
 (0)