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(subscriptions): fix race between subscription sync and cache #689

Merged
merged 3 commits into from
Jan 29, 2019

Conversation

njhale
Copy link
Member

@njhale njhale commented Jan 28, 2019

Adds a "generated-by" annotation to subscriptions generated for requiredAPIs that contains the name of the generating installplan. If the "generated-by" installplan is not present in the cache at the generated subscription's sync time, the subscription is resynced until it is.

Addresses ALM-884.

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 28, 2019
Adds a "generated-by" annotation to subscriptions generated for
requiredAPIs that contains the name of the generating installplan.
If the "generated-by" installplan is not present in the cache at the
generated subscription's sync time, the subscription is resynced until
it is.
@@ -47,6 +47,8 @@ const (
serviceKind = "Service"
roleKind = "Role"
roleBindingKind = "RoleBinding"

generatedByKey = "olm/generated-by"
Copy link
Member

Choose a reason for hiding this comment

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

elsewhere we used olm. as a prefix. Also gofmt

ipName, ok := sub.GetAnnotations()[generatedByKey]
if !ok {
// err := fmt.Errorf("no installplan reference or %s annotation found", generatedByKey)
// logger.WithField("err", err.Error()).Error("an error occurred while associating a subscription with an installplan")
Copy link
Member

Choose a reason for hiding this comment

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

remove commented code?

@@ -567,6 +567,7 @@ func TestCreateInstallPlanWithPreExistingCRDOwners(t *testing.T) {
// existing cleanup should remove this
createSubscriptionForCatalog(t, crc, testNamespace, subscriptionName, mainCatalogSourceName, mainPackageName, betaChannel, v1alpha1.ApprovalAutomatic)

// time.Sleep(5 * time.Minute)
Copy link
Member

Choose a reason for hiding this comment

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

commented

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 29, 2019
@@ -145,6 +145,43 @@ type Step struct {
Status StepStatus `json:"status"`
}

// ManifestsMatch returns true if the CSV manifests in the StepResources of the given list of steps
// matches those in the InstallPlanStatus.
func (s *InstallPlanStatus) CSVManifestsMatch(steps []*Step) bool {
Copy link
Member

Choose a reason for hiding this comment

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

if you make this a method on installplan, can't we skip half of this calculation? (spec.clusterServiceVersionNames is a list of the csvs)

Copy link
Member

Choose a reason for hiding this comment

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

discussed in person - nevermind 😄

Copy link
Member

@ecordell ecordell left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 29, 2019
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ecordell, njhale

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-merge-robot openshift-merge-robot merged commit 88ecace into operator-framework:master Jan 29, 2019
ecordell pushed a commit to ecordell/operator-lifecycle-manager that referenced this pull request Mar 8, 2019
fix(subscriptions): fix race between subscription sync and cache
@ecordell ecordell added the kind/bug Categorizes issue or PR as related to a bug. label Mar 19, 2019
@njhale njhale deleted the fix-ip-race branch September 30, 2019 21:38
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. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants