Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce UpgradeStrategy field to OperatorGroups (#235)
This commit introduces the upgradeStrategy field to the operatorGroup type. The upgradeStrategy field defines OLM behavior when upgrading operators in the namespace. Two upgrade strategies are currently supported, "Default" and "TechPreviewUnsafeFailForward". The "Default" strategy mimics existing behavior. The "TechPreviewUnsafeFailForward" strategy allows users to recover from failed installPlans or failed clusterServiceVersions, it should be noted that these upgrades are unsafe and can lead to unpredictable behavior and potentially dataloss. Upstream-repository: api Upstream-commit: 33310d6154f344da5494c788451bd34cdf54711c
- Loading branch information
Showing
8 changed files
with
211 additions
and
2 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,70 @@ | ||
package v1 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestUpgradeStrategy(t *testing.T) { | ||
tests := []struct { | ||
description string | ||
og *OperatorGroup | ||
expected UpgradeStrategy | ||
}{ | ||
{ | ||
description: "NoSpec", | ||
og: &OperatorGroup{}, | ||
expected: UpgradeStrategyDefault, | ||
}, | ||
{ | ||
description: "NoUpgradeStrategy", | ||
og: &OperatorGroup{ | ||
Spec: OperatorGroupSpec{}, | ||
}, | ||
expected: UpgradeStrategyDefault, | ||
}, | ||
{ | ||
description: "NoUpgradeStrategy", | ||
og: &OperatorGroup{ | ||
Spec: OperatorGroupSpec{ | ||
UpgradeStrategy: "", | ||
}, | ||
}, | ||
expected: UpgradeStrategyDefault, | ||
}, | ||
{ | ||
description: "NonSupportedUpgradeStrategy", | ||
og: &OperatorGroup{ | ||
Spec: OperatorGroupSpec{ | ||
UpgradeStrategy: "foo", | ||
}, | ||
}, | ||
expected: UpgradeStrategyDefault, | ||
}, | ||
{ | ||
description: "DefaultUpgradeStrategy", | ||
og: &OperatorGroup{ | ||
Spec: OperatorGroupSpec{ | ||
UpgradeStrategy: "Default", | ||
}, | ||
}, | ||
expected: UpgradeStrategyDefault, | ||
}, | ||
{ | ||
description: "UnsafeFailForwardUpgradeStrategy", | ||
og: &OperatorGroup{ | ||
Spec: OperatorGroupSpec{ | ||
UpgradeStrategy: "TechPreviewUnsafeFailForward", | ||
}, | ||
}, | ||
expected: UpgradeStrategyUnsafeFailForward, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.description, func(t *testing.T) { | ||
require.EqualValues(t, tt.expected, tt.og.UpgradeStrategy()) | ||
}) | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
vendor/github.com/operator-framework/api/crds/operators.coreos.com_operatorgroups.yaml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.