Skip to content

Commit f6da41e

Browse files
committed
more descriptive upgrade contstraint policy constants
1 parent 57ac405 commit f6da41e

File tree

6 files changed

+58
-58
lines changed

6 files changed

+58
-58
lines changed

api/v1alpha1/clusterextension_types.go

+8-8
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
@@ -323,22 +323,22 @@ type CatalogSource struct {
323323
// the upgrade path(s) defined in the catalog are enforced for the package
324324
// referenced in the packageName field.
325325
//
326-
// Allowed values are: ["Enforce", "Ignore"].
326+
// Allowed values are: ["CatalogProvided", "SelfCertified"].
327327
//
328-
// When this field is set to "Enforce", automatic upgrades will only occur
328+
// When this field is set to "CatalogProvided", automatic upgrades will only occur
329329
// when upgrade constraints specified by the package author are met.
330330
//
331-
// When this field is set to "Ignore", the upgrade constraints specified by
331+
// When this field is set to "SelfCertified", the upgrade constraints specified by
332332
// the package author are ignored. This allows for upgrades and downgrades to
333333
// any version of the package. This is considered a dangerous operation as it
334334
// can lead to unknown and potentially disastrous outcomes, such as data
335335
// loss. It is assumed that users have independently verified changes when
336336
// using this option.
337337
//
338-
// If unspecified, the default value is "Enforce".
338+
// If unspecified, the default value is "CatalogProvided".
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

+7-7
Original file line numberDiff line numberDiff line change
@@ -330,28 +330,28 @@ 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
337337
referenced in the packageName field.
338338
339-
Allowed values are: ["Enforce", "Ignore"].
339+
Allowed values are: ["CatalogProvided", "SelfCertified"].
340340
341-
When this field is set to "Enforce", automatic upgrades will only occur
341+
When this field is set to "CatalogProvided", automatic upgrades will only occur
342342
when upgrade constraints specified by the package author are met.
343343
344-
When this field is set to "Ignore", the upgrade constraints specified by
344+
When this field is set to "SelfCertified", the upgrade constraints specified by
345345
the package author are ignored. This allows for upgrades and downgrades to
346346
any version of the package. This is considered a dangerous operation as it
347347
can lead to unknown and potentially disastrous outcomes, such as data
348348
loss. It is assumed that users have independently verified changes when
349349
using this option.
350350
351-
If unspecified, the default value is "Enforce".
351+
If unspecified, the default value is "CatalogProvided".
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)