Skip to content

Bug 1826443: Pod Config Deployment Hash Error #1472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/controller/install/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ func IsErrorUnrecoverable(err error) bool {
if err == nil {
return false
}
_, ok := unrecoverableErrors[reasonForError(err)]
_, ok := unrecoverableErrors[ReasonForError(err)]
return ok
}

func reasonForError(err error) string {
func ReasonForError(err error) string {
Copy link
Contributor

@benluddy benluddy May 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking "out loud" here: it might be nice to (later!) use some of the newer error wrapping features from the standard library in place of the {Reason, Message} that exists today.

switch t := err.(type) {
case StrategyError:
return t.Reason
Expand Down
6 changes: 5 additions & 1 deletion pkg/controller/operators/olm/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,11 @@ func (a *Operator) updateInstallStatus(csv *v1alpha1.ClusterServiceVersion, inst
}

if strategyErr != nil {
csv.SetPhaseWithEventIfChanged(requeuePhase, requeueConditionReason, fmt.Sprintf("installing: %s", strategyErr), now, a.recorder)
if install.ReasonForError(strategyErr) == install.StrategyErrDeploymentUpdated {
csv.SetPhaseWithEventIfChanged(v1alpha1.CSVPhaseInstallReady, requeueConditionReason, fmt.Sprintf("installing: %s", strategyErr), now, a.recorder)
} else {
csv.SetPhaseWithEventIfChanged(requeuePhase, requeueConditionReason, fmt.Sprintf("installing: %s", strategyErr), now, a.recorder)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the reason InstallWaiting when this branch is hit, and is that the most appropriate reason in this case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is somewhat weird given the function signature - you would expect the requeue phase to be used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline - this whole state management should probably be refactored to make this behavior clearer, but doing so here would make it difficult to backport.

}
if err := a.csvQueueSet.Requeue(csv.GetNamespace(), csv.GetName()); err != nil {
a.logger.Warn(err.Error())
}
Expand Down
29 changes: 29 additions & 0 deletions pkg/controller/operators/olm/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2244,6 +2244,35 @@ func TestTransitionCSV(t *testing.T) {
},
},
},
{
name: "SingleCSVInstallingToInstallReady",
initial: initial{
csvs: []runtime.Object{
csvWithAnnotations(csv("csv1",
namespace,
"0.0.0",
"",
installStrategy("csv1-dep1", nil, nil),
[]*apiextensionsv1.CustomResourceDefinition{},
[]*apiextensionsv1.CustomResourceDefinition{},
v1alpha1.CSVPhaseInstalling,
), defaultTemplateAnnotations),
},
clientObjs: []runtime.Object{defaultOperatorGroup},
crds: []runtime.Object{},
objs: []runtime.Object{
withLabels(
deployment("csv1-dep1", namespace, "sa", defaultTemplateAnnotations),
map[string]string{install.DeploymentSpecHashLabelKey: "BadHash"},
),
},
},
expected: expected{
csvStates: map[string]csvState{
"csv1": {exists: true, phase: v1alpha1.CSVPhaseInstallReady, reason: "InstallWaiting"},
},
},
},
{
name: "SingleCSVSucceededToSucceeded/UnmanagedDeploymentInNamespace",
initial: initial{
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/subscription_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/discovery"

"github.com/operator-framework/api/pkg/lib/version"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver"
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/comparison"
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
"github.com/operator-framework/api/pkg/lib/version"
"github.com/operator-framework/operator-lifecycle-manager/test/e2e/ctx"
)

Expand Down Expand Up @@ -1212,10 +1212,6 @@ var _ = Describe("Subscription", func() {
require.NotNil(GinkgoT(), subscription)

csv, err := fetchCSV(GinkgoT(), crClient, subscription.Status.CurrentCSV, testNamespace, buildCSVConditionChecker(v1alpha1.CSVPhaseSucceeded))
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

// 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.
csv, err = fetchCSV(GinkgoT(), crClient, subscription.Status.CurrentCSV, testNamespace, buildCSVConditionChecker(v1alpha1.CSVPhaseSucceeded))
}
require.NoError(GinkgoT(), err)

proxyEnv := proxyEnvVarFunc(GinkgoT(), config)
Expand Down