Skip to content
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

fix ansible reconcile when cr was not found #2032

Conversation

camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Oct 10, 2019

Description of the change:

When the CR is deleted we should stop the reconcile which shows that is NOT and it shows not happening. See that the markDone and markError will return nil then the reconcile will not have the info which is required to be stoped.

Motivation for the change:

#2031

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 10, 2019
@camilamacedo86
Copy link
Contributor Author

/test e2e-aws-ansible

1 similar comment
@camilamacedo86
Copy link
Contributor Author

/test e2e-aws-ansible

@camilamacedo86 camilamacedo86 force-pushed the fix-ansible-reconcile branch 2 times, most recently from c451e83 to 92e59c8 Compare October 10, 2019 16:00
@camilamacedo86
Copy link
Contributor Author

/test e2e-aws-subcommand
/test e2e-aws-ansible

@camilamacedo86
Copy link
Contributor Author

/test e2e-aws-ansible
/test e2e-aws-subcommand

@camilamacedo86
Copy link
Contributor Author

/test e2e-aws-ansible

Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

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

IIUC, the changes to markDone and markError would actually result in extra reconciliations because we would end up returning the not found error instead of nil, when returning from the Reconcile() method. So I think those changes should be reverted.

I don't think the other refactoring and logging changes are necessary, since they just add extra logs to the operator output that are probably more debug/trace type of logs, but I'll defer to @fabianvf to see if he thinks we should add more verbosity.

if apierrors.IsNotFound(err) {
logger.Info("Resource not found, assuming it was deleted", err)
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

This change would result in returning an error from this function when the CR is not found, which would result in returning an error from the main Reconcile function (see here).

By returning the not found error, we would trigger another Reconcile unnecessarily. By returning nil, the Reconcile function will also return nil, which will result in no further reconciliations occurring.

Ditto for the changes in markError, except that we never actually check the error returned from markError. In the markError cases, we always return the original error no matter what happens with markError.

return reconcile.Result{}, nil
}
// Error reading the object - requeue the request.
logger.Error(err, "Failed to get Resource.")
Copy link
Member

Choose a reason for hiding this comment

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

I don't think it is necessary to log this error, since controller-runtime will also log it when we return from Reconcile().

Ditto for the logged error in line 209.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Oct 10, 2019

@camilamacedo86: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-aws-ansible bb3ad27 link /test e2e-aws-ansible
ci/prow/e2e-aws-helm bb3ad27 link /test e2e-aws-helm

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@camilamacedo86
Copy link
Contributor Author

Hi @joelanford,

Thank you for your explanations. It makes sense. I am closing this one.

@camilamacedo86 camilamacedo86 deleted the fix-ansible-reconcile branch October 11, 2019 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants