-
Notifications
You must be signed in to change notification settings - Fork 544
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
fix(subscriptions): fix race between subscription sync and cache #689
Conversation
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" |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code?
test/e2e/installplan_e2e_test.go
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented
@@ -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 { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed in person - nevermind 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[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 |
fix(subscriptions): fix race between subscription sync and cache
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.