Skip to content

Commit 80e90dd

Browse files
Merge pull request #1472 from awgreene/podconfig-test-flake
Bug 1826443: Pod Config Deployment Hash Error
2 parents cfbca70 + d9d9b49 commit 80e90dd

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

pkg/controller/install/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ func IsErrorUnrecoverable(err error) bool {
3838
if err == nil {
3939
return false
4040
}
41-
_, ok := unrecoverableErrors[reasonForError(err)]
41+
_, ok := unrecoverableErrors[ReasonForError(err)]
4242
return ok
4343
}
4444

45-
func reasonForError(err error) string {
45+
func ReasonForError(err error) string {
4646
switch t := err.(type) {
4747
case StrategyError:
4848
return t.Reason

pkg/controller/operators/olm/operator.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1773,7 +1773,11 @@ func (a *Operator) updateInstallStatus(csv *v1alpha1.ClusterServiceVersion, inst
17731773
}
17741774

17751775
if strategyErr != nil {
1776-
csv.SetPhaseWithEventIfChanged(requeuePhase, requeueConditionReason, fmt.Sprintf("installing: %s", strategyErr), now, a.recorder)
1776+
if install.ReasonForError(strategyErr) == install.StrategyErrDeploymentUpdated {
1777+
csv.SetPhaseWithEventIfChanged(v1alpha1.CSVPhaseInstallReady, requeueConditionReason, fmt.Sprintf("installing: %s", strategyErr), now, a.recorder)
1778+
} else {
1779+
csv.SetPhaseWithEventIfChanged(requeuePhase, requeueConditionReason, fmt.Sprintf("installing: %s", strategyErr), now, a.recorder)
1780+
}
17771781
if err := a.csvQueueSet.Requeue(csv.GetNamespace(), csv.GetName()); err != nil {
17781782
a.logger.Warn(err.Error())
17791783
}

pkg/controller/operators/olm/operator_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,35 @@ func TestTransitionCSV(t *testing.T) {
22442244
},
22452245
},
22462246
},
2247+
{
2248+
name: "SingleCSVInstallingToInstallReady",
2249+
initial: initial{
2250+
csvs: []runtime.Object{
2251+
csvWithAnnotations(csv("csv1",
2252+
namespace,
2253+
"0.0.0",
2254+
"",
2255+
installStrategy("csv1-dep1", nil, nil),
2256+
[]*apiextensionsv1.CustomResourceDefinition{},
2257+
[]*apiextensionsv1.CustomResourceDefinition{},
2258+
v1alpha1.CSVPhaseInstalling,
2259+
), defaultTemplateAnnotations),
2260+
},
2261+
clientObjs: []runtime.Object{defaultOperatorGroup},
2262+
crds: []runtime.Object{},
2263+
objs: []runtime.Object{
2264+
withLabels(
2265+
deployment("csv1-dep1", namespace, "sa", defaultTemplateAnnotations),
2266+
map[string]string{install.DeploymentSpecHashLabelKey: "BadHash"},
2267+
),
2268+
},
2269+
},
2270+
expected: expected{
2271+
csvStates: map[string]csvState{
2272+
"csv1": {exists: true, phase: v1alpha1.CSVPhaseInstallReady, reason: "InstallWaiting"},
2273+
},
2274+
},
2275+
},
22472276
{
22482277
name: "SingleCSVSucceededToSucceeded/UnmanagedDeploymentInNamespace",
22492278
initial: initial{

test/e2e/subscription_e2e_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,10 +1204,6 @@ var _ = Describe("Subscription", func() {
12041204
require.NotNil(GinkgoT(), subscription)
12051205

12061206
csv, err := fetchCSV(GinkgoT(), crClient, subscription.Status.CurrentCSV, testNamespace, buildCSVConditionChecker(v1alpha1.CSVPhaseSucceeded))
1207-
if err != nil {
1208-
// TODO: If OLM doesn't have the subscription in its cache when it initially creates the deployment, the CSV will hang on "Installing" until it reaches the five-minute timeout, then succeed on a retry. It should be possible to skip the wait and retry immediately, but in the meantime, giving this test a little extra patience should mitigate flakes.
1209-
csv, err = fetchCSV(GinkgoT(), crClient, subscription.Status.CurrentCSV, testNamespace, buildCSVConditionChecker(v1alpha1.CSVPhaseSucceeded))
1210-
}
12111207
require.NoError(GinkgoT(), err)
12121208

12131209
proxyEnv := proxyEnvVarFunc(GinkgoT(), config)

0 commit comments

Comments
 (0)