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(sub): Reset ResolutionFailed cond when error is resolved #2296

Merged

Conversation

anik120
Copy link
Contributor

@anik120 anik120 commented Jul 28, 2021

Description of the change:

In #2269, a new condition was introduced for Subscription to indicate any
dependency resolution error in it's message. However, when the case of
the error was resolved, the condition status (true) and the message
was sticking around. This PR fixes the issue, and makes sure that the
condition status is set to false, and the message and reason of the
condition are cleared off.

Motivation for the change:

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /doc
  • Commit messages sensible and descriptive

@anik120 anik120 force-pushed the reset-sub-condition branch 2 times, most recently from c605f28 to dc5bae5 Compare July 28, 2021 17:25
@anik120 anik120 force-pushed the reset-sub-condition branch 2 times, most recently from 49f6ef6 to 79eae9c Compare July 30, 2021 18:02
@anik120 anik120 force-pushed the reset-sub-condition branch 5 times, most recently from 36d140b to d7563eb Compare August 24, 2021 12:43
In operator-framework#2269, a new condition was introduced for Subscription to indicate any
dependency resolution error in it's message. However, when the case of
the error was resolved, the condition status (true) and the message
was sticking around. This PR fixes the issue, and makes sure that the
condition status is set to false, and the message and reason of the
condition are cleared off.

Signed-off-by: Anik Bhattacharjee <anikbhattacharya93@gmail.com>
…'s own task

Signed-off-by: Anik Bhattacharjee <anikbhattacharya93@gmail.com>
The statuses of the subscriptions are updated multiple number of times
while syncing the resolving namespace. This commit switches to preserving
the state of the subscription statues instead, and only updating the
statuses on cluster only when it's neccessary.

Signed-off-by: Anik Bhattacharjee <anikbhattacharya93@gmail.com>
@benluddy
Copy link
Contributor

/approve

@openshift-ci
Copy link

openshift-ci bot commented Aug 24, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anik120, benluddy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 24, 2021
pkg/controller/operators/catalog/operator.go Outdated Show resolved Hide resolved
_, err = o.client.OperatorsV1alpha1().Subscriptions(s.Namespace).UpdateStatus(context.TODO(), latest, updateOpts)

latest.Status = sub.Status
sub = *latest
Copy link
Member

Choose a reason for hiding this comment

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

I might be misunderstanding the intent here, but based on https://github.com/operator-framework/operator-lifecycle-manager/pull/2296/files#r678478765, it seems like you're trying to make sure that subs has the latest version of this particular sub in it.

This line seems like it only changes the sub that is scoped to the goroutine defined starting in line 1275. It seems like if you're trying to update the sub variable defined in line 1273, you should either:

  1. change the name of sub at line 1275 to avoid shadowing sub at line 1273, OR
  2. add an index variable for the for loop, pass that to the goroutine, and then set subs[i] = latest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joelanford you're right that the intent is to make sure subs has the latest version of the particular sub in it. And also, the sub inside the goroutine is what's being changed here. But if you notice in L1294, it's the individual sub from subs that's being passed to the goroutines, so it's effectively achieving the same objective as what the options you laid out would.

Signed-off-by: Anik Bhattacharjee <anikbhattacharya93@gmail.com>
Signed-off-by: Anik Bhattacharjee <anikbhattacharya93@gmail.com>
@joelanford
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 24, 2021
@openshift-merge-robot openshift-merge-robot merged commit dedbbed into operator-framework:master Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants