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

(feature) Implement polling image source in intervals #185

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

anik120
Copy link
Collaborator

@anik120 anik120 commented Oct 6, 2023

@anik120 anik120 requested a review from a team as a code owner October 6, 2023 13:56
@anik120 anik120 self-assigned this Oct 6, 2023
@anik120 anik120 marked this pull request as draft October 6, 2023 13:57
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 6, 2023
@anik120
Copy link
Collaborator Author

anik120 commented Oct 6, 2023

Based off of #145. Commit to review: 4764cd9

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Attention: 23 lines in your changes are missing coverage. Please review.

Comparison is base (bd8cfbd) 46.15% compared to head (388d040) 39.70%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #185      +/-   ##
==========================================
- Coverage   46.15%   39.70%   -6.46%     
==========================================
  Files           6        8       +2     
  Lines         364      471     +107     
==========================================
+ Hits          168      187      +19     
- Misses        177      265      +88     
  Partials       19       19              
Files Coverage Δ
api/core/v1alpha1/catalog_types.go 100.00% <ø> (ø)
internal/source/image_registry_client.go 67.07% <100.00%> (+0.40%) ⬆️
internal/source/unpacker.go 0.00% <ø> (ø)
pkg/controllers/core/catalog_controller.go 80.50% <100.00%> (+3.28%) ⬆️
api/core/v1alpha1/zz_generated.deepcopy.go 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

internal/source/unpacker.go Outdated Show resolved Hide resolved
api/core/v1alpha1/catalog_types.go Outdated Show resolved Hide resolved
cmd/manager/main.go Outdated Show resolved Hide resolved
cmd/manager/main.go Outdated Show resolved Hide resolved
config/manager/manager.yaml Outdated Show resolved Hide resolved
config/samples/core_v1alpha1_catalog.yaml Outdated Show resolved Hide resolved
internal/source/image_registry_client.go Outdated Show resolved Hide resolved
internal/source/image_registry_client.go Outdated Show resolved Hide resolved
pkg/controllers/core/catalog_controller.go Outdated Show resolved Hide resolved
@ncdc ncdc added this to the v0.8.0 milestone Oct 10, 2023
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 10, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 11, 2023
api/core/v1alpha1/catalog_types.go Outdated Show resolved Hide resolved
pkg/controllers/core/catalog_controller.go Outdated Show resolved Hide resolved
pkg/controllers/core/catalog_controller.go Show resolved Hide resolved
pkg/controllers/core/catalog_controller.go Show resolved Hide resolved
api/core/v1alpha1/catalog_types.go Outdated Show resolved Hide resolved
api/core/v1alpha1/catalog_types.go Outdated Show resolved Hide resolved
api/core/v1alpha1/catalog_types.go Outdated Show resolved Hide resolved
if catalog.Spec.Source.Image.PollInterval == nil {
return false
}
// if it's not time to poll yet, and the CR wasn't changed don't unpack again
Copy link
Member

Choose a reason for hiding this comment

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

This works as-is, but for future reference, it's often much easier to reason about a series of simple if conditions vs. a combination of conditions. Specifically, I find this easier:

if catalog.Generation != catalog.Status.ObservedGeneration {
  return true
}
if nextPoll.After(time.Now()) {
  return true
}
return false

@ncdc ncdc added this pull request to the merge queue Oct 19, 2023
Merged via the queue into operator-framework:main with commit 0b86f72 Oct 19, 2023
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable polling for content for Image Source
7 participants